I would like to plot a variable at each unit-time interval. In the example below I would therefore like to plot x at time equal to 1, 2, 3, 4 and 5 (but not time equal to 1.25, 1.5, 1.75, 2.25 and so on). Is it for example possible to save the x-array for times equal to 1, 2, 3, 4 and 5, and then plot this vs time (so we should get five graphs in the same figure)?
dtime=0.25; % time-step
NTime=5/dtime; % Number of time-steps
dspace=0.5; % Distance between each x-values
NSpace=10/dspace; % Number of x-values at each time-steps
x_old=ones(NSpace,1);
for j=1:NTime
for i=1:NSpace
x(i,1)=x_old(i,1)*5;
end
x_old=x;
end