This code is not working, it return an issue stating with vector length, please help out

1 view (last 30 days)
L = 100e-3 ; a=30e-3; Ex = 12/((1e-3)^3 * 0.5934);
I = (5e-3)*(1e-3)^3 / 12;
x1 = 1e-3:1e-3:30e-3;
x2 = 31e-3:1e-3:100e-3;
for x=1:1:30
for r=1:1:69
v(x)=(100*(x1(x))/(24*L*Ex*I))*(L*(x1(x))^3-4*a*L*(x1(x))^2+2*a^2*(x1(x))^2+4*a^2*L^2-4*a^3*L+a^4);
w(r)=((100*a^2) /(24*L*Ex*I))*(2*(x2(r))^3-6*L*(x2(r))^2+a^2 *(x2(r))+4*L^2 *(x2(r))-a^2*L);
end
end
plot(x1,v,x2,w)

Answers (1)

per isakson
per isakson on 18 Apr 2020
The size of the variables, x2 and w, must be the same. They are not.
>> whos x1 v x2 w
Name Size Bytes Class Attributes
v 1x30 240 double
w 1x69 552 double
x1 1x30 240 double
x2 1x70 560 double
This plot-statement works
plot(x1,v,x2(1:69),w)

Products

Community Treasure Hunt

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

Start Hunting!