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

1 Ansicht (letzte 30 Tage)
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)

Akzeptierte Antwort

Sylvain Lacaze
Sylvain Lacaze am 8 Jan. 2020
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 Kommentare
Sylvain Lacaze
Sylvain Lacaze am 9 Jan. 2020
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Finlay Brierton
Finlay Brierton am 10 Jan. 2020
Sylvain,
This is exactly what I was looking for, thank you so much.
Finlay

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by