l=1000; %mm
a=50; %mm^2
e=100; %KN/mm^2
h=0;
X=(0:10:500);
Y=[];
o=h/l;
lp=l/cos(o);
ld=(lp+l)/l;
while h < 500
t=e.*a.*ld./l;
p=2.*t.*h./l;
o=h./l;
h=h+10;
lp=l./cos(o);
ld=(lp+l)./l;
Y(h)=p;
end
plot(x,y,'r-')
Here is my code. Am I missing something? Could someone fix it and explain to me, thank you.

 Respuesta aceptada

Star Strider
Star Strider el 21 de Sept. de 2018
I seee two problems:
First, you need to define ‘X’ as:
X=0:499;
Second, MATLAB is case-sensitive, so ‘x’ is different from ‘X’. (The same obviously applies to ‘y’ and ‘Y’.)
With that change and this corrected plot call:
plot(X,Y,'r-')
your plot appears.

2 comentarios

ping meng wan
ping meng wan el 22 de Sept. de 2018
It's work! Thank you. I'm very new with this program.
Star Strider
Star Strider el 22 de Sept. de 2018
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Polar Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 21 de Sept. de 2018

Comentada:

el 22 de Sept. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by