Graph figure wont show
Afficher commentaires plus anciens
clc;clear all;
l=25;
E=200e9;
I=350e-6;
w=6e3;
for x=linspace(0,l/2,25)
y=(-(w*x)/(384*E*I))*(16*(x^3)-24*l*(x^2)+9*(l^3))
end
for x=linspace(l/2,l,26)
y=(-(w*x)/(384*E*I))*(8*(x^3)-24*l*(x^2)+17*x*(l^2)-(l^3))
end
figure
plot(x,y)
Réponse acceptée
Plus de réponses (1)
Thorsten
le 26 Nov 2014
Because your y is just a single point. Work on the whole vector and make sure to use .*, ./ and .^ when you want point-wise operation.
l=25;E=200e9;I=350e-6;w=6e3;
x=linspace(0,l/2,25); y=(-(w*x)/(384*E*I)).*(16*(x.^3)-24*l*(x.^2)+9*(l^3)) ;
plot(x, y, 'b')
hold on
x=linspace(l/2,l,26); y=(-(w*x)/(384*E*I)).*(8*(x.^3)-24*l*(x.^2)+17*x*(l^2)-(l^3));
hold on
plot(x, y, 'r')
1 commentaire
ernest
le 26 Nov 2014
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
