haixiaofan-007
2009-03-07, 22:42
我这是一个太阳能集热器将热水储存到水箱里的模型,首先有太阳能集热器吸收太阳能将集热器里的水加热,然后和水箱进行循环,即集热器的进口温度是水箱的温度ts,集热器的出水温度是tfo,我通过分别建立集热器出水温度微分方程得到tfo的变化模型%和水箱的温度ts的微分方程得到,通过解微分方程就可以得到0点到23点的24小时的水箱里的水温和集热器出水温度每小时的值,但是这里有个问题,就是这两个模型是相互关联的,像我下面的程序,collectorfun中含有未知的ts,storagefun中含有tfo,当我运行时会出现错误提示:‘Undefined function or variable'ts'.’和‘Undefined function or variable 'tfo'.’这个问题怎么解决,程序这么编写才合适?
为出水温度。ts为水箱水的温度,初始值均为10度,微分方程采用4阶Runge-Kutta格式解
程序如下
tfo=10;ts=10;
for t=1:24
tfi=ts
collectorfun=inline('1/(60.8571*0.5146)*(0.87521*(0.6*0.84-3.9619/1000*(tfi-5))*3600+3600*0.015*4.1968*(tfi-tfo))','t','tfo');
[t,tfo]=nark4(collectorfun,[t-1,t],tfo,1);tfo=tfo(2),
storagefun=inline('1/(245600*4.1968)*(0.015*4.1968*2456*(tfo-ts)*3600-3600*0.7*235.1/1000*(ts-5))','t','ts');
[t,ts]=nark4(storagefun,[t-1,t],ts,1);ts=ts(2),
end
为出水温度。ts为水箱水的温度,初始值均为10度,微分方程采用4阶Runge-Kutta格式解
程序如下
tfo=10;ts=10;
for t=1:24
tfi=ts
collectorfun=inline('1/(60.8571*0.5146)*(0.87521*(0.6*0.84-3.9619/1000*(tfi-5))*3600+3600*0.015*4.1968*(tfi-tfo))','t','tfo');
[t,tfo]=nark4(collectorfun,[t-1,t],tfo,1);tfo=tfo(2),
storagefun=inline('1/(245600*4.1968)*(0.015*4.1968*2456*(tfo-ts)*3600-3600*0.7*235.1/1000*(ts-5))','t','ts');
[t,ts]=nark4(storagefun,[t-1,t],ts,1);ts=ts(2),
end