Graph figure wont show
Show older comments
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)
Accepted Answer
More Answers (1)
Thorsten
on 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')
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!