Selecting values to make further calculations

2 ビュー (過去 30 日間)
Finlay Brierton
Finlay Brierton 2020 年 2 月 17 日
編集済み: Cris LaPierre 2020 年 2 月 24 日
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);

採用された回答

Cris LaPierre
Cris LaPierre 2020 年 2 月 18 日
編集済み: Cris LaPierre 2020 年 2 月 24 日
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));
  1 件のコメント
Finlay Brierton
Finlay Brierton 2020 年 2 月 23 日
Thanks Chris, I will try and work on this

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by