필터 지우기
필터 지우기

Multi-variable fminsearch: Not enough input arguments

조회 수: 2 (최근 30일)
Devdatt Thengdi
Devdatt Thengdi 2018년 3월 7일
댓글: Torsten 2018년 3월 13일
I am getting 'Not enough input arguments' as result. Need help.
Function:
function qout = Lobo(d0, L, Tg, nb, uo)
clc
%Fuel flowrate
Ti = 251.9 + 273.15; %Fluid in degK
T0 = 386.1 + 273.15; %Fluid/gas out degK
cpL = 0.32; %Cp fluid KJ/kgdegK
flowL = 500; %flowrate fluid kg/s
THD = flowL.*cpL.*(T0 - Ti);%Total Heat Duty
Ef = 0.9320; %Fuel efficiency
qfuel = THD./Ef;%Heat released by fuel Kw
LHV = 41.05; %Fuel value KJ/kg
mfuel = qfuel./LHV;
%absorptivity
hp = 6.626*(10^-34); %planck's constant m2kg/s
cl = 3*(10^8); %speed of light m2/s
lamda = hp*cl/qfuel; %wavelength
Avog = 6.023*10^24; %Avogadro's number
x1 = 0.9;
M1 = 16;
x2 = 0.1;
M2 = 29;
fatmass = x1*M1 + x2*M2; %fuel molecular mass
nA = mfuel*Avog*fatmass; %number of atoms
pi = 22/7;
alpha = 4.*pi.*nA./lamda;
%Exchange factor
x = pi.*d0/2; %ctc
F = ((sqrt(x.^2 - 4) - x + 2.*sinh(2./x))/2.*pi);
%Heat transfer coefficient
k = 0.25*10^-3; %Thermal conductivity
%rof = 1320; %density
Gm = 920880; %mass flowrate
mu = 130; %Viscosity Pa-s
A0 = pi.*d0.*d0./4;
h0 = ((d0./k).*(0.023.*((Gm.*d0./mu.*A0).^0.8).*((cpL.*mu./k)).^0.3));
%Tube wall temperature
Tref = 41; %Ambient
Tw = Tref + (Ti - T0)/L;
%Air
ea = 0.15; %excess air
cpair = 0.171; %Kcal/kgdegK
Tairin = 114;
atfr = 1.344; %in notebook
mair = mfuel.*atfr.*(1+ea);
%Flame calculation
cpsteam = 4.1855;
cpco2 = 0.918;
cpn2 = 1.044;
xco2 = 0.054;
xsteam = 0.034; %Total should be 8.8
xn2 = 0.66;
cpgas = xsteam.*cpsteam + xco2.*cpco2 + xn2.*cpn2;
kgas = 0.25; %Thermal conductivity
mgas = mfuel + mair;
Lf = 0.0042.*(qfuel.^0.478); %flame length
tf = sqrt(pi.*uo.*Lf.*cpgas./mgas.*kgas); %flame size
db = 1.5.*tf; %Burner tile diameter
dbc = db./(sin(180./nb) + (pi./nb)); %Burner circle diameter
%Cold plane area
cbt = (qfuel.*1.055/4*10^6) + 1.5;
dtc = cbt + dbc; %tube circle diameter
ntubes = pi.*dtc./x;
Ar = L.*ntubes.*x;
%Radiant heat flux
stef = 5.67*10^-8; %Stefan-Boltzmann constant
qr = stef.*alpha.*F.*(Tg.^4 - Tw.^4) + ho.*(Tg - Tw);
%qr = stef*alpha*((sqrt((pi*d0)^2 - 16) - 2*x + 2*sinh(4/pi*d0))/4*pi)*(Tg^4 - (Tref + (Ti - T0)/L)^4) + ((d0/k)*(0.023*((Gm*d0/mu*pi*d0*d0/4)^0.8)*((cpL*mu/k))^0.3))*(Tg - (Tref + (Ti - T0)/L));
%Heat leaving
Qr = qr .* Ar; %total radiant heat absorbed
%Qr = qr * L*pi*(((qfuel*1.055/4*10^6) + 1.5) + ((1.5*(sqrt(pi*uo*Lf*cpgas/mgas*kgas)))/(sin(180/nb) + (pi/nb))));
qair = mair.*cpair.*(Tairin - Tref);
qloss = 0.05.*qfuel;
qout = qfuel + qair - ((stef.*alpha.*((sqrt((pi.*d0).^2 - 16) - 2.*x + 2*sinh(4/pi.*d0))/4*pi).*(Tg.^4 - (Tref + (Ti - T0)/L).^4) + ((d0/k).*(0.023.*((Gm.*d0/mu.*pi.*d0.*d0/4)^0.8).*((cpL.*mu./k)).^0.3)).*(Tg - (Tref + (Ti - T0)/L)).*L.*pi.*(((qfuel.*1.055/4*10^6) + 1.5) + ((1.5.*(sqrt(pi.*uo.*Lf.*cpgas./mgas.*kgas)))/(sin(180/nb) + (pi/nb))))) + qloss);
end
Solution:
%d0 = 0.01:1;
%L = 1:18;
%Tg = 1:1950;
%nb = 8:12;
%uo = 1:50;
x0 = [0.01, 1, 10, 8, 1];
options = optimset('PlotFcns',@optimplotfval);
X = fminsearch(@Lobo, x0, options);
qr = @Lobo;
plot (d0,qr)
xlabel('Tube circle diameter (d0)');
ylabel('flux (qr)');

답변 (1개)

Walter Roberson
Walter Roberson 2018년 3월 7일
X = fminsearch(@Lobo, x0, options);
invokes Lobo with one input vector which is the same length as x0.
You probably want
X = fminsearch(@(x) Lobo(x(1),x(2),x(3),x(4),x(5)), x0, options);
  댓글 수: 22
Devdatt Thengdi
Devdatt Thengdi 2018년 3월 13일
Thanks. One Last thing. In a multiobjective function (e.g. gamultiobj) how do you minimize one function and maximize the other?
Torsten
Torsten 2018년 3월 13일
Set F=[F1,-F2] - then both functions F1 and F2 are to be minimized.
Best wishes
Torsten.

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

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by