Inputting known values and being able to select them depending on calculated value

조회 수: 1 (최근 30일)
Hi,
Sorry I worded this question badly beforehand.
As you can see from my screenshot and code, I have calculated the Mr (max bending moment) for a steel portal frame of dimensions (w,L,h).
Having calculated this moment I would like the programme to suggest a steel section with a suitable max bending moment resistance. A made a small example list at bottom of my coding, but I will be putting in all the sections and their corresponding bending moment resistance so I can get suggested sections for when I change the frame variables.
How can I get the program to suggest suitable section sizes for the calculated Mr?
Thanks
% program code equivalent to the graphical design method %
% as far as rafter selection %
w = 10; % w is the udl on the fram
L = 30; % L is the span of the frame
h = 6.5; % h is the height to eaves of the frame
theta = 12; % theta is the roof pitch of the frame
N = L/2 + h/tand(theta); % N is the distance from stanchion to base of reactant line where it meets the ground level
syms m
eqn = m^2/(2*w) + m*(5*N/3 - L/3) + w*L^2/8; % the derived equation from the graphical method to find gradient
M = solve(eqn,m); % solving the equation
m1 = max(double(M)); % choosing the smaller negative negative gradient (so smaller number)
Y = -(w/2)*(-m1/w).^2 + w*L^2/8; % the equation for the parabola at max bending moment (at x-bar)
R = -(m1.^2/w) - m1.*N; % the equation for the reactant at max bending moment (at x-bar)
Mr = Y - R; % (KNm) the differce in y values at x-bar gives the max bending moment in the rafter
steel sections: 406x178x67, 406x178x74, 406x178x85 % dimensions of specific steel sections (taken from steel design book)
section moment: 370, 413, 459 % Bending moment resistance for the sections labelled above (taken from steel design book)

채택된 답변

Sylvain Lacaze
Sylvain Lacaze 2020년 1월 8일
Hi Finlay,
You could turn pproject into a function:
Say:
function Mr = pproject(w, L, h)
% Your stuff
end
Then compute the Mr for all your cross sections:
w = [..., ..., ...];
L = [..., ..., ...];
h = [..., ..., ...];
Mr = zeros( 1, numel( w ) );
for i = 1:numel( w )
Mr(i) = pproject( w(i), L(i), h(i) );
end
And rank best on closest to target Mr:
[~, rank] = sort( abs( Mr - MrTarget ) );
disp( 'Best cross section' )
disp( rank )
You could also consider vectorizing pproject:
HTH,
Sylvain
  댓글 수: 2
Finlay Brierton
Finlay Brierton 2020년 1월 8일
Hi Sylvain,
Thank you very much for your answer, I have updated the question as I dont think I worded it very well intitially. I think I was asking something slightly different to what you answered.
Thanks
Sylvain Lacaze
Sylvain Lacaze 2020년 1월 9일
Hi Finlay,
OK, I think I see.
So let's say you have Mr, your computed max bending moment.
Then, let's say you have a table like this:
Name = ["crossSection1"; "crossSection2"; "crossSection3"];
Resistance = [370; 413; 459];
crossSectionInfo = table( Name, Resistance );
First, sort by Resistance, to make sure you go from weakest to strongest:
crossSectionInfo = sortrows( crossSectionInfo, 'Resistance' );
Then find the find cross section with a Resistance higher than the max bending moment Mr:
bestCrossSectionIndex = find( crossSectionInfo.Resistance > Mr, 1, 'first' );
That's your cross-section:
disp( crossSectionInfo(bestCrossSectionIndex,:) )
HTH,
Sylvain

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Finlay Brierton
Finlay Brierton 2020년 1월 10일
Sylvain,
This is exactly what I was looking for, thank you so much.
Finlay

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by