使用Matlab中的for循环,增量为15
我对matlab非常陌生,我必须使用一个以15为增量的for循环作为坐标点 我试过了使用Matlab中的for循环,增量为15,matlab,loops,for-loop,increment,Matlab,Loops,For Loop,Increment,我对matlab非常陌生,我必须使用一个以15为增量的for循环作为坐标点 我试过了 for theta = 0; and(theta <= 360, theta >= 0) theta +15; end 第二个是我使它工作的极限,但它仍然超过360,第一个似乎更有意义,但它给了我一个错误,说θ以前被用作变量 y12 = sind(theta) + cosd(theta); y1 = sind(theta); y2=cosd(theta); plot(theta,y12) plot
for theta = 0; and(theta <= 360, theta >= 0)
theta +15;
end
第二个是我使它工作的极限,但它仍然超过360,第一个似乎更有意义,但它给了我一个错误,说θ以前被用作变量
y12 = sind(theta) + cosd(theta);
y1 = sind(theta);
y2=cosd(theta);
plot(theta,y12)
plot(theta,y1)
plot(theta,y2)
title 'Project 7D - 3 curves(0-2*pi)'
xlabel 'Angle in Radian'
ylabel 'Function Value'
0:15:360
从0开始,每次递增15,到360结束
0:15:360
从0开始,每次递增15,到360结束这实际上不需要循环
theta=0:15:360;
y12 = sind(theta) + cosd(theta);
y1 = sind(theta);
y2 = cosd(theta);
hold all;
plot(theta,y12)
plot(theta,y1)
plot(theta,y2)
title 'Project 7D - 3 curves(0-2*pi)'
xlabel 'Angle in Radian'
ylabel 'Function Value'
这实际上不需要一个循环
theta=0:15:360;
y12 = sind(theta) + cosd(theta);
y1 = sind(theta);
y2 = cosd(theta);
hold all;
plot(theta,y12)
plot(theta,y1)
plot(theta,y2)
title 'Project 7D - 3 curves(0-2*pi)'
xlabel 'Angle in Radian'
ylabel 'Function Value'
当我插入绘图时,它只使用360作为值。我在主体中添加了它。当我插入绘图时,它只使用360作为值。我在主体中添加了它
theta=0:15:360;
y12 = sind(theta) + cosd(theta);
y1 = sind(theta);
y2 = cosd(theta);
hold all;
plot(theta,y12)
plot(theta,y1)
plot(theta,y2)
title 'Project 7D - 3 curves(0-2*pi)'
xlabel 'Angle in Radian'
ylabel 'Function Value'