Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Matlab中的for循环,增量为15_Matlab_Loops_For Loop_Increment - Fatal编程技术网

使用Matlab中的for循环,增量为15

使用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

我对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(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'