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

1 visualización (últimos 30 días)
an
an el 16 de Mzo. de 2014
Comentada: an el 27 de Mzo. de 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') hold
  3 comentarios
an
an el 27 de Mzo. de 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')

Iniciar sesión para comentar.

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by