I'm trying to plot sin(x) and sin(2x) and 3x and so on up to sin(nx) all on the same graph. My code right now is as follows.
x=[-2*pi:pi/64:2*pi];i = input('Enter a positive whole number: \n');z=[1:i];y=sin(x.*z);for z = [1:i] plot(x,y);end
It's giving me an error saying:
Matrix dimensions must agree.
Error in lab5_exercise2 (line 9)
y=sin(x.*z);
Best Answer