Solving an equation and using the answer for other equations
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to write some code for my thesis and am struggling to convert an equation I derived into matlab. The code relates to steel member selection for varyingnd portal fram dimensions. Y - R is the target bending capacity of the beam. I have attached my written work and attempted coding, thanks.
w = 8.37;
L = 30;
h = 6.5;
theta = 12;
N = L/2 + h/tand(theta);
syms m
eqn = m^2/2*w + m*(5*N/3 - L/3) + w*L^2/8 == 0
M = solve(eqn,m)
Y = -(w/2)*(-m/w)^2 + w*L^2/8;
R = -(m^2/w) - m*N;
Mr = Y - R
0 个评论
采纳的回答
Cameron B
2020-1-7
w = 8.37;
L = 30;
h = 6.5;
theta = 12;
N = L/2 + h/tand(theta);
syms m
eqn = m^2/(2*w) + m*(5*N/3 - L/3) + w*L^2/8;
M = solve(eqn,m);
m1 = double(M);
Y = -(w/2)*(-m1/w).^2 + w*L^2/8;
R = -(m1.^2/w) - m1.*N;
Mr = Y - R
This gives both roots of m and gives Mr = 294.8667 and 22178.87.
3 个评论
Cameron B
2020-1-7
format longG %formats your answer how you want it
If you want the smallest room of m, then there are two ways of thinking about it. The first is picking the smallest of the two numbers which would be:
m1 = min(double(M));
However, the above line is biased towards negative values. If you wanted the smallest absolute value of the two, you would do this:
m1 = min(abs(double(M)));
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!