Matlab

reevin
exam1_1.m

t=0:2:360; %define the range of t %initialise each of the functions y1=sin(3*t); y2=cos(3*t); % y1(find(y1 > .5)) = 0.5; % y1(find(y1 < -.5)) = -0.5; % y2(find(y2 > .5)) = .5; % y2(find(y2 < -.5)) = -.5; y1=y1.*(0.5>y1<0.5); figure (1) subplot(2,1,1) %subplot 2x2 plot 1 plot(t,y1) %plot sin 3t title('Sin Curve') %title sin curve xlabel('x') %set the x axis label ylabel('sin(3t)') %set the y axis label legend('sin(3t)') %show legend ylim([-1,1]) %set limit to the y axis axis([0 360 -1 1]) grid on subplot(2,1,2) %subplot 2x2 plot 1 plot(t,y2) %plot cos 3t title('Cos Curve') %title sin curve xlabel('x') %set the x axis label ylabel('cos(3t)') %set the y axis label legend('cos(3t)') %show legend ylim([-1,1]) %set limit to the y axis axis([0 360 -1 1]) grid on