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

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 Kommentare

dpb
dpb am 16 Mär. 2014
Format the code so we can read it...
an
an am 27 Mär. 2014
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')

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Roger Stafford
Roger Stafford am 16 Mär. 2014

0 Stimmen

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

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

an
am 16 Mär. 2014

Kommentiert:

an
am 27 Mär. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by