%% 2D Plot in Matlab www.mechanicsoft.ir close all x=-10:1:10; y=sin(50.*x)+.01.*x.^3; figure(1);plot(x,y) title('plot f(x)=sin(50.*x)+.01.*x.^3'); xlabel('Time'); ylabel('Displasement'); legend('blue'); text(-6,6,' \uparrow www.mechanicsoft.ir','FontSize',18); %% 2D Multi Plot in Matlab www.mechanicsoft.ir %% First Method x=-10:1:10; y=sin(50.*x)+.01.*x.^3; z=cos(50.*x)-.01.*x.^4; w=-cos(50.*x)+.01.*x.^4; figure(2);plot(x,y,'--b',x,z,'.-g',x,w,':r','LineWidth',2) title('plot y=f_1(x) ,z=f_2(x),w=f_3(x)'); xlabel('Time'); ylabel('Displasement'); legend('blue','green','red'); text(-7,-100,' www.mechanicsoft.ir','FontSize',18); %% Second Method x=-10:1:10; y=sin(50.*x)+.01.*x.^3; z=cos(50.*x)-.01.*x.^4; w=-cos(50.*x)+.01.*x.^4; figure(3); plot(x,y,'o','color',[1 0 1],'LineWidth',2) hold on plot(x,z,'.-','color',[.5 .75 0],'LineWidth',2) plot(x,w,'x','color',[0 0 1],'LineWidth',2) title('plot y=f_1(x) ,z=f_2(x),w=f_3(x)'); xlabel('Time'); ylabel('Displasement'); legend('color1','color2','color3'); text(-7,-100,' www.mechanicsoft.ir','FontSize',18);