Solving an equation and using the answer for other equations

1 view (last 30 days)
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. IMG_7244.jpg
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

Accepted Answer

Cameron B
Cameron B on 7 Jan 2020
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 Comments
Finlay Brierton
Finlay Brierton on 7 Jan 2020
Also I am not looking to solve the bending moment capacity for a portal frame of variables: w, L, h, theta.
Once I require Mr, will insert the values of Mr from the steel eurocodes and the program will suggest suitable steel section based on the calculated value.
thanks
Cameron B
Cameron B on 7 Jan 2020
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)));

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!