how can i change the for loop in this program..?

3 次查看(过去 30 天)
r=10
P1=10^9 w1=4.55 w2=5.13 h=8; for x=1;2;3;4;5;6;7;8;9;10; d= 20.*x end w=d; d0=0.4 B1=(d./d0).^(1./3) s=d./r; A1=d.^2 E0=8.85*10^-12 b=6.830890 E1=b.*w1.^1.5 E1g=b.*w2.^1.5 E2=E1./B1
E2g=E1g./B1 c=E2.*d./B1 cg=E2g.*d./B1 x=0.5.*E0.*E2.^2.*10^18 xg=0.5.*E0.*E2g.^2.*10^18 A2=A1.*(x./P1) A2g=A1.*(xg./P1) v1=d.*A1 v=(d+h).*(A1+A2) vg=(d+h).*(A1+A2g) u=x.*(v1./v) ug=xg.*(v1./vg) plot(d,u,'green') hold plot(d,ug,'red') hold
  3 个评论
an
an 2014-3-27
r=10
P1=10^9 w1=4.55 w2=5.13 h=8; for x=1;2;3;4;5;6;7;8;9;10; d= 20.*x end w=d; d0=0.4 B1=(d./d0).^(1./3) s=d./r; A1=d.^2 E0=8.85*10^-12 b=6.830890 E1=b.*w1.^1.5 E1g=b.*w2.^1.5 E2=E1./B1
E2g=E1g./B1 c=E2.*d./B1 cg=E2g.*d./B1 x=0.5.*E0.*E2.^2.*10^18 xg=0.5.*E0.*E2g.^2.*10^18 A2=A1.*(x./P1) A2g=A1.*(xg./P1) v1=d.*A1 v=(d+h).*(A1+A2) vg=(d+h).*(A1+A2g) u=x.*(v1./v) ug=xg.*(v1./vg) plot(d,u,'green') hold plot(d,ug,'red')

请先登录,再进行评论。

采纳的回答

Roger Stafford
Roger Stafford 2014-3-16
In place of your for-loop you can have:
d = 20*[1:10].';
or
d = linspace(20,200,10);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by