plot figure from a vector saved from a for cycle

hi, i am saving a vector from a for cycle but when i try to plot all te saved value on the figure it appears just the last value of the plot.
this is the script
rep1 = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26];
for i = 1:length(rep1);
name=['TimeHistory_',int2str(rep1(i)), '.dat'];
fid = fopen( name, 'r');
if fid==-1;disp(msg);end [time,dispVR,dispVL,P15,Temp,RH,Fs]=importdata(fid);
[dispV,dispV_h,y01,y01_h,f_spec,f_v01,y01_h_m,zeta,zetair]= signalprocess1(time,dispVR,dispVL,P15,Temp,RH,Fs);
[U,Re,dinvisc,Umean]=reference (P15,Temp,RH);
peak = max(dispV) + abs(min(dispV));
RMS = sqrt(rms(dispV));
out (i,:) = [zeta zetair f_v01 Umean Re peak RMS];
Re_vec (i)= [Re];
Peak_vec (i)= [peak];
RMS_vec (i)= [RMS];
end
% Plot peak to peak over Re
figure()
plot(Re_vec (i), Peak_vec (i))
title('Peak to Peak Displacement')
legend('Peak to Peak', 's')
xlabel('Re')
ylabel('Peak to Peak, [mm]')
please help me

 Réponse acceptée

Yep. Use
plot(Re_vec, Peak_vec)
to plot all data. The way you have it set up right now, you only plot the i th data point, which, after running through the loop would be the last one.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by