Plot the following functions on the same graph for x values from -π to π. selecting spacing to create a smooth plot: y1 = sin (x) y2 = sin(2x) y3 = sin(3x)
x = -3.14:0.01*3.14:3.14;
y1 = sin(x);
plot(x,y1)
hold on
y2 = sin(2*x);
plot(x,y2)
hold on
y3 = sin(3*x);
plot(x,y3)
hold off
title('Figures for y1, y2 and y3')
xlabel('x in radians');
ylabel('sin(x)/sin(2x)/sin(3x)');
legend('sin(x)','sin(2x)','sin(3x)')
grid
Comments
Leave a comment