怎么在MATLAB程序中求解参数变化的非线性方程组,并返回方程组的解

方程:function F=Area3(canshu)
% qijk=8.8;
% wh=1.18;
% Aijk=0.9;
% th_in=451.43;
% tc_out=351.1805;
% ke_ijk=0.1;
th_out=canshu(1);
tc_in=canshu(2);
F(1)=qijk-(wh*(th_in-th_out));
dt1=th_in-tc_out;
dt2=th_out-tc_in;
LMTDijk=(dt1*dt2*(dt1+dt2)/2)^(1/3);
F(2)=Aijk-(qijk/ke_ijk/LMTDijk);
我现在这样写,参数传不进去:
qijk=8.8;
wh=1.18;
Aijk=0.9;
th_in=451.43;
tc_out=351.1805;
ke_ijk=0.1;
x=fsolve('Area3',[400,300],optimset('Display','off'));
a1=x(1);
a2=x(2);
或者不写function方程,直接在主程序中x=fsolve(……),也不知道怎么写
找到了,不让发链接吗 ?www点ilovematlab.cn/thread-40644-1-1.html

怎么在MATLAB程序中求解参数变化的非线性方程组,并返回方程组的解。可以这样来处理:

1、用已定义的函数文件,即文件名为Area3.m

function F=Area3(canshu)
qijk=8.8;wh=1.18;Aijk=0.9;
th_in=451.43;tc_out=351.1805;
ke_ijk=0.1;
th_out=canshu(1); 
tc_in=canshu(2); 
F(1)=qijk-(wh*(th_in-th_out));
dt1=th_in-tc_out;
dt2=th_out-tc_in;
LMTDijk=(dt1*dt2*(dt1+dt2)/2)^(1/3);
F(2)=Aijk-(qijk/ke_ijk/LMTDijk);

end

2、在命令窗口输入

canshu0=[400,300]  %初值,注意初值变量不能与自变量相同(出错的原因

x=fsolve('Area3',canshu0,optimset('Display','off'));
>> a1=x(1),a2=x(2)

运行结果:a1 =  443.9724;a2 =  348.6387

温馨提示:答案为网友推荐,仅供参考
相似回答