Hi all,
trying to solve a system of nonlinear equations with fsolve but without success. These are my files

%main
global Ab thick Dp ac W_n P porosity L R T_0 F_A0 F_B0 F_C0 F_D Db Dr T_o
%all the global variables are problem constants
x0=[1e2 1e4 .2 400 400 100 1]; % [k_c D_AB X T_r T_w Q m_steam]
[x,fval] = fsolve(@tankreactor,x0)

function y = tankreactor(x)
global Ab thick Dp ac W P porosity L R T_0 F_A0 F_B0 F_C0 F_D Db Dr T_o
M_D = .018;
mu_v = 1.4055e05;
rho_v = 2.6658;
rho_l = 915.48;
lambda_v = 0.03187;
k_steel = 17;
DeltaH_vap = 2257;
DeltaH_reac = 102.95;
v_0 = (F_A0+ F_B0+ F_C0+ F_D)*R*T_0/(P*Ab);
y = [F_A0  F_A0*(1x(3))*(1 + x(1)*ac*W/(F_A0*(1x(3))+F_B0+F_C0+F_D)*P/(R*x(4)));
(Cp('A',x(4))*F_A0*(1x(3))+Cp('B',x(4))*(F_B0F_A0*x(3))+Cp('C',x(4))*(F_C0+F_A0*x(3))+Cp('D',x(4))*F_D)*(x(4)T_0)*.001 ...
+ DeltaH_reac*x(1)*ac*W*F_A0*(1x(3))/(F_A0*(1x(3))+F_B0+F_C0+F_D)*(P/(R*x(4))) + x(6);
x(6)  (21*thermal_cond(x(4)) + 0.23*(v_0*Dp*P/(R*x(4))*(Cp('A',x(4))*F_A0*(1x(3))+Cp('B',x(4))*(F_B0F_A0*x(3))+ ...
Cp('C',x(4))*(F_C0+F_A0*x(3))+Cp('D',x(4))*F_D)/(F_A0*(1x(3))+F_B0+F_C0+F_D)))*.001*(x(5)x(4))*(Db/2);
x(6)  (1/((21*thermal_cond(x(4)) + 0.23*(v_0 * Dp * P/(R*x(4)) * (Cp('A',x(4))*F_A0*(1x(3))+Cp('B',x(4))*(F_B0F_A0*x(3))+ ...
Cp('C',x(4))*(F_C0+F_A0*x(3))+Cp('D',x(4))*F_D)/(F_A0*(1x(3))+F_B0+F_C0+F_D)))*2.8*(v_0 * Dp * P/(R*x(4)) * ...
((Cp('A',x(4))*F_A0*(1x(3))+Cp('B',x(4))*(F_B0F_A0*x(3))+Cp('C',x(4))*(F_C0+F_A0*x(3))+Cp('D',x(4))*F_D)/ ...
(F_A0*(1x(3))+F_B0+F_C0+F_D))/thermal_cond(x(4)))^(.25)/Dp) + (thick/k_steel) + 1/(.002*(4*x(7)/(pi*Dr*mu_v))^.6* ...
(mu_v/(rho_v*9.81*(rho_lrho_v)*lambda_v^3))^(1/3)))^(1)*.001*(T_ox(5))*pi*L*(Db+thick/2);
x(6)  (DeltaH_vap*x(7));
(0.765/((P*M_D*v_0*Dp/(R*x(4)*viscosity(x(4))))^.82) + 0.365/(P*M_D*v_0*Dp/((R*x(4)*viscosity(x(4))))^.386))/porosity  ...
(x(1)*Dp/x(2))/((viscosity(x(4))*R*x(4)/(P*M_D*x(2)))^(1/3) * P*M_D*v_0*Dp/(R*x(4)*viscosity(x(4))));
x(1)*Dp/x(2)  (2 + 0.6*((P*M_D*v_0*Dp/(R*x(4)*viscosity(x(4))))^.5)*((viscosity(x(4))*R*x(4)/(P*M_D*x(2)))^(1/3)))];

Cp.m, thermal_conductivity.m and viscosity.m are support files.
I have seven unknown variables and seven equations but receive the following error message when trying to solve the system

Warning: Trustregiondogleg algorithm of FSOLVE cannot handle nonsquare systems; using
LevenbergMarquardt algorithm instead.
> In fsolve at 324
In model_main at 60
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
default value of the function tolerance.

I have tried relaxing the tolerances and changing the initial points without success.
Thanks for any advice on how to proceed with this problem!
// Fredric
