Function works with one input but not the other

조회 수: 2 (최근 30일)
Samir Chaouki
Samir Chaouki 2022년 4월 14일
댓글: Samir Chaouki 2022년 4월 14일
Im using the optimisation tool and have set everything up following the tutorial on the mathwork website, the tool works when the input is Y but not when the input is T_to, which is what id like it to be. T_to input only works when the number of variables is one, which doesnt give me a useful result.
I should disclose im still very new to matlab so its possible that the problem is very simple.
function F = mymulti1(T_to)
y = 20640000;
%T_to = 3050; %degC
A_choke = 0.0531; %m^2
A_Rat = 78;
A_Exit = A_choke * A_Rat; %m^2
T_Exit = 343.2;
M_Exit = 1.65; %Ratio
Gamma = 1.26; %Const
Gas_const = 287.5; %Const
MFR = ((A_choke * y) ./ (sqrt(T_to))) * (sqrt(Gamma / Gas_const)) * ( ((Gamma + 1) / 2)^-((Gamma + 1) / 2*(Gamma - 1)));
Pressure_Exit = (1 + ((Gamma - 1) / 2) * ((M_Exit) ^ 2))^ - (Gamma /(Gamma - 1)) * y;
Velocity_Exit = M_Exit * sqrt(Gamma * Gas_const * T_Exit);
Thrust = (MFR .* Velocity_Exit) + (A_Exit * Pressure_Exit);
F(2) = Thrust ./ MFR ;
F(1) = (y .* A_choke) ./ MFR;
end

답변 (1개)

VBBV
VBBV 2022년 4월 14일
F(2,:) = Thrust ./ MFR ;
F(1,:) = (y .* A_choke) ./ MFR;
Check the size of output matrix
  댓글 수: 10
VBBV
VBBV 2022년 4월 14일
Try A histogram plot in output display
Samir Chaouki
Samir Chaouki 2022년 4월 14일
Hi VBBV,
you've helped already a massive amount but if i could just trouble you a little more.
attached is the plot ive got and the kind of plot im trying to get. what would you recommend i do?
Thanks
Samir

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multiobjective Optimization에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by