Combinations of values in vectors
1 ビュー (過去 30 日間)
Here is my question: if the first logical expression is correct, depth_tot_7 will be calculated. If not, the (if correct) next logical check calculates depth_tot_5 or depth_tot_3. What I additionally want to achieve are the following two things:
a) I want to define a range from 3, 5, 7 for lam without having to specify one of these values at the beginning. It´s either 3, 5 or 7. Depending on this value, the if function shall be performed. If I define the range for lam, for some reason depth_tot_3 is calculated, while if a single value for lam is defined, the if function is performed correctly.
b) If i.ie. lam=3, I would like the program to combine all of the possible lamella depths that are contained in the regarding formula. This means that I´d like my programm to create total depths where lamellas have different attributed depths (for lam = 3 i.e. 25*2+50, 35*2+20, 50*2+35, 45*2+50 etc.). I would like to achieve that the values are differently combined to each other, considering the fact that these single lamellas have the same range and steps.
I hope that my explanation is now clear and looking forward to your answers and help.
%span length [m]
%Number of lamellas [-]
%Depth outer lamella parallel to span [mm]
%Depth inner lamella parallel to span [mm]
%Depth inner lamella cross to span [mm]
%Calculation of total depth [mm]
回答 (1 件)
Athul Prakash 2020 年 11 月 3 日
To answer both your questions..
a) I'm assuming that you don't want to specify 'lam' in the code (along with the if part). You may consider wrapping the calculation (the whole if body) into a function, after which the function can be called for any 'lam' from outside.
b) I'm not sure what you're trying to calculate here. Could you clarify in relation to the code you've posted?