how to I fill a vector with the results from my loop?
Mostrar comentarios más antiguos
I am very rusty with matlab,
I have written my code and I want to keep all my variables constant except for my xa value and run it from 0 to 20 in steps of 0.1.
I made a loop and I can run it, but I can't remember how to store the values of the output "delta_z" so I can graph them.
Any help would be appreciated.
jamie
%inital set up
%forces
for xa=0:0.1:20
p=12
ql=2
qw=3
b=3
%locations
za=6
xp= 5
xql=7
xqw=10
if xa<xqw
xw = abs(xa-xqw)+b/2;
else
xw = abs(xa-xqw-b/2);
end
if xw > b/2
dist_load = (qw/pi)*(atan(za/((xw-(b/2))))-atan(za/(xw+(b/2)))...
-(b*za*(((xw)^2)-za^2-(b^2/4)))/(((xw)^2+za^2-(b^2/4))^2+b^2*za^2));
else
dist_load = (qw/pi)*(pi+atan(za/((xw-(b/2))))-atan(za/(xw+(b/2)))...
-(b*za*(((xw)^2)-za^2-(b^2/4)))/(((xw)^2+za^2-(b^2/4))^2+b^2*za^2));
end
%Individual Stress Equations
L = sqrt(abs(xa-xp)^2+(za^2));
line_load = (2*ql*za^3)/(pi*((abs(xa-xql)^2)+za^2)^2);
point_load = (3*p*za^3)/(2*pi*(L)^5);
dist_load;
delta_z = line_load + point_load + dist_load;
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
