Solving an equation and using the answer for other equations

조회 수: 1 (최근 30일)
Finlay Brierton
Finlay Brierton 2020년 1월 7일
댓글: Cameron B 2020년 1월 7일
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

채택된 답변

Cameron B
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
Finlay Brierton
Finlay Brierton 2020년 1월 7일
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 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개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by