How to plot Gaussian spikes individually for peaks then show them summed together?

1 view (last 30 days)
Hello, I am basically trying to create something that looks like this:
I am curretnly using a program that gives me the overall line shape after the Gaussian peaks have been added together. I can't seem to be able to plot the individual peaks that make it though.
I am doing something like:
spike_positions=[matrix of variable size depending on above functions];
Intensity= [matrix of Intensities as a function of spike_positions];
minvec=min[spike_position];
maxvec=max[spike_positions];
vec=0:1/srate:max_vec-min_vec;
spkvec=zeros(size(vec));
for i=1:length(spkpos)
t=gausswin(srate-1,alpha)';
t = t*Intensity(i);
start_end=[spkpos(i)-(round(srate/2)-1) spkpos(i)+(round(srate/2)-1) 1 srate-1];
if spkpos(i)<=(round(srate/2)-1);
start_end(1)=1;
start_end(3)=(round(srate/2)+1)-spkpos(i);
end
if spkpos(i)+(round(srate/2)-1)>=length(spkvec);
start_end(2)=length(spkvec);
start_end(4)=1+start_end(2)-start_end(1);
end
spkvec(start_end(1):start_end(2))=spkvec(start_end(1):start_end(2))+t(start_end(3):start_end(4));
end
vec=vec+min_vec+1/srate;
figure
plot(spkvec,'r')
This has worked well for me so far, but I would really like to see the individual peaks at each peak postions, not just the resulting sum. Any advice ?

Answers (0)

Categories

Find more on Measurements and Feature Extraction in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!