MATLAB Answers

Selecting values to make further calculations

3 views (last 30 days)
I am trying to complete the next step of my coding to design steel portal frames. For my next calculations I need to select a rafter section so I can do my stanchion calculations based on the resistance of my chosen rafter section. How can I select one of my displayed sections below and use the moment resistance as stated to continue my calcs.
Lr = 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*Lr/3 - L/3) + w*L^2/8; % derived graphical method equation
M = solve(eqn,m);
m1 = max(double(M));
Y = -(w/2)*(-m1/w).^2 + w*L^2/8;
R = -(m1.^2/w) - m1.*Lr;
Mr = Y - R; % Target rafter Mp
disp (table( Mr ))
% Values from Blue Book put into directory to suggest members
Name = ["254x102x28"; "254x146x31"; "254x146x37"; "254x146x43"; "305x102x25"; "305x102x28";
Resistance = [97.1; 108; 133; 156; 94.1; 111; 132; 148; 169; 196; 171; 198; 233; 149; 181;
crossSectionInfo = table( Name, Resistance );
crossSectionInfo = sortrows( crossSectionInfo, 'Resistance' );
bestCrossSectionIndex = find( crossSectionInfo.Resistance > Mr, 5, 'first'); % five sections with suitable Mp resistance
disp( crossSectionInfo(bestCrossSectionIndex,:) )
result = input('Which steel section would you like to select?:');
disp( 'Value is');


Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 18 Feb 2020
Edited: Cris LaPierre on 24 Feb 2020
There are a couple errors with the snippet of code included above, but I suspect that is becaue some code is missing. Assuming it runs without error when it is all there, I'd suggest a couple things.
  1. use the str = input(prompt,'s') syntax. The 's' means a string input is expected. Read more here.
  2. Once you capture the input, you need to do a comparison to find which item in Name it corresponds to.
  3. Use the info from #2 to find the corresponding row in Resistance.
A stripped down version of how you could do this is below.
result = input('Which steel section would you like to select?:','s');
disp( 'Value is');

  1 Comment

Finlay Brierton
Finlay Brierton on 23 Feb 2020
Thanks Chris, I will try and work on this

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Translated by