Selecting values to make further calculations

1 view (last 30 days)
Hi,
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.
Thanks
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');
disp(crossSectionInfo.Resistance);

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');
disp(crossSectionInfo.Resistance(Name==result));

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!