# Plotting graph in a certain range

9 views (last 30 days)
Sohel Rana on 21 Sep 2020
Commented: VBBV on 22 Sep 2020
Hi,
I have a graph which conatins a lots of peaks within a ceratin range. I would like to plot graphs where each graph will conatin just only one peak.From the follwiing graph, I would like to plot five graphs between 0-50 (graph1), 50-100 (graph2), 100-150(graph3), 150-200(graph4), 200-250(graph5). It should plot five graphs one by one within their corresponding range. I don't want to use axis limit manually as it will take lot of time. Is there any way to use for loop or other loops that will plot five graphs one by one within the above certain range? I would really appreciate your help.
I VBBV on 21 Sep 2020
Edited: VBBV on 21 Sep 2020
Use subplot and findpeaks functions to plot it
% if true
% code
% end
Intensity = [...];
[Pk,Lc] = findpeaks(Intensity);
% Pk is peak value and Lc is the location where it occurs in vectors, Lc = [Lc1 Lc2 ...];
subplot(511)
plot(pixeldata(0:Lc1),Intensity(0:Lc1));
...
subplot(512)
plot(pixeldata(Lc1:Lc2),Intensity(Lc1:Lc2))
...
VBBV on 22 Sep 2020
Or use figure(1) figure(2)... instead of subplot