Undefined function 'power' for input arguments of type 'function_handle'

3 visualizzazioni (ultimi 30 giorni)
%SCRIPT
[M2,H] = B249VALVEcurve()
cv_249= [M2];
[M,H] = B251valveperfcurve()
cv_251 = [M]; % a vector for opening from 1 - 100%
m_tot = 8;
for i = 1:100
for j = 1:100
m_w2(i,j) = fzero(@(m_w2)fzerotry(@(m_w2)cv_249(i), cv_251(j)), 4)
m_w2_f(i,j) = m_w2;
m_w1_f(i,j) = m_tot - m_w2;
j = j+1;
end
i = i +1;
end
% FUNCTION
function fun = fzerotry(m_w2, cv_249,cv_251)
% global cv_249, cv_251
PD_pipe2 = 0.96; % In kPa from toolbox online - assuming 3 inch dia, 20 ft length, flow rate for 5 kg/sec
PD_DIC1 = (160*(m_w2.^2) + (2.3*10^3)*m_w2 - 10^4)/1e3;
rho_w =refpropm('D','T',345,'P',400,'water');
Q_w2 = m_w2./rho_w;
Q_w2_hr = 3600*Q_w2; % in m3/hr
PD_pipe1 = 0.96;
PD_oc = 5;
PD_IC1= (590*(m_tot^2 - m_w2.^2) + 0.42*(m_tot - m_w2)+ 0.56)/1e3;
PD_IC2 =(590*(m_tot^2 - m_w2.^2) + 0.4*(m_tot - m_w2)+ 0.51)/1e3;
PD_AC= (1400*(m_tot^2 - m_w2^2) + 0.37*(m_tot - m_w2) + 0.44)/1e3;
rho_w1 =refpropm('D','T',360,'P',280,'water'); % assuming 280, anyways rho shouldnt vary much
Q_w1 = m_tot/rho_w1;
Q_w1_hr= 3600*Q_w1; % in m3/hr
kv_249 = 0.865*cv_249; % gpm into m3/hr
DP_B249 = ((Q_w2_hr/kv_249)^2)*(10^2); % Q is in m3/hr, and Press is in kPa
kv_251 = 0.865*cv_251;
DP_B251 = ((Q_w1_hr/kv_251)^2)*(10^2); % Q is in m3/hr, and Press is in kPa
PD_1 = PD_pipe1 +PD_oc +PD_IC1 +PD_IC2 + PD_AC + DP_B251;
PD_2 = PD_pipe2 + PD_DIC1 + DP_B249+ PD_AC+ DP_B251;
fun = PD_1 - PD_2
end

Risposte (1)

Stephen23
Stephen23 il 29 Ago 2017
Modificato: Stephen23 il 29 Ago 2017
That second @(...) makes no sense, so remove it:
m_w2(i,j) = fzero(@(m_w2)fzerotry(m_w2, cv_249(i), cv_251(j)), 4)

Community Treasure Hunt

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

Start Hunting!

Translated by