Introduction to MATLAB
Line Plots
>> t = 0:pi/100:2*pi;
>> y = sin(t);
>> plot(t,y)
>> xlabel('t')
>> ylabel('sin(t)')
>> title('The plot of t vs sin(t)')
>> y2 = sin(t-0.25);
>> y3 = sin(t+0.25);
>> hold on; % <== to keep previously defined stuff
>> plot(t,y,t,y2,t,y3) % why not just plot only the 2nd and 3 curves?
>> legend('sin(t)','sin(t-0.25)','sin(t+0.25',1)
|