Error using * (line 334) Dimensions do not match., trying to multiply an array by a constant
4 views (last 30 days)
Show older comments
%Internal virtual work intergrate with limits 0-L (M1)*M1v)/(E*I(x))
%Virtual load = atchual load
x = 0:0.17:L
I = ([b1*(H_o-((H_o-h_o)*x)/L).^3]/12)-([b2*(H_i-((H_o-h_o)*x)/L).^3]/12)
RA1 = (3/8)*w*L
RB1 = (w*L)-RA1
figure(3);
M1 = ((RA1*x)-(w*x.^2)/2)
plot(x,M1)
figure(4);
V = RA1-(w*x)
plot(x,V)
M1v = RA1v*x
figure(5);
Def = (M1*M1v)/(E.*I)
plot(x,Def)
Error using * (line 334)
Dimensions do not match.
Error in codeq1 (line 81)
Def = (M1*M1v)/(E.*I)
i am using this code to try and get the deflection of a point in beam with a varied cross section.
M1,M1v and I all vary with x and i have values for all the points along them buy seting x as 15 separate points between 0 and my beam length.
i am trying to plot 15 points of this equation Def = (M1*M1v)/(E.*I) but i get the error;
i assume its becasue E is a single number
anyone know what i can do to make this run and get the 15 values out
0 Comments
Answers (1)
Benjamin Thompson
on 4 Feb 2022
You have not posted code that defines all the variables. If E is supposed to be scalar, then replace ".*" with juts "*". If the I variable is not supposed to be scalar, use "./" instead of "/"and ensure the size of I is the same size as (M1*M1v).
Def = (M1*M1v)./(E*I)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!