- use the str = input(prompt,'s') syntax. The 's' means a string input is expected. Read more here.
- Once you capture the input, you need to do a comparison to find which item in Name it corresponds to.
- Use the info from #2 to find the corresponding row in Resistance.
Selecting values to make further calculations
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Finlay Brierton
am 17 Feb. 2020
Bearbeitet: Cris LaPierre
am 24 Feb. 2020
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);
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 18 Feb. 2020
Bearbeitet: Cris LaPierre
am 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.
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));
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Mathematics 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!