声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1010|回复: 1

[编程技巧] 关于相平衡的问题

[复制链接]
发表于 2009-12-8 00:00 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
function y=Profit(v)
tem=linspace(300,400,11);
con=tem.^4*7.25524475523*10^(-9)-tem.^3*1.0316045066*10^(-5)+tem.^2*5.42210664335*10^(-3)-tem.*1.24286734654+1.05099508158*10^2;
DEsel=tem.^3*5.24475524476*10^(-9)-tem.^2*5.71678321678*10^(-6)+tem.*1.97132867133*10^(-3)-2.08454545455*10^(-1);
PYsel=tem.*0.001-0.22;
%for R401%;
F1IP=100*0.88;
F1WA=100-F1IP;
F2IP=F1IP-F1IP*con;
F2DE=con.*DEsel.*(F1IP./(1+DEsel+PYsel));
F2PY=con.*PYsel.*(F1IP./(1+DEsel+PYsel));
F2AC=F1IP*con.*(1./(1+DEsel+PYsel));
F2WA=F2DE+F2PY;
F2HY=F2AC;
F3WA=F2AC*0.01;
sumzi=F2IP+F2DE+F2AC+F3WA+F1WA+F2WA;
%for T-401%
global z
IPzi=F2IP./sumzi
DEzi=F2DE./sumzi
ACzi=F2AC./sumzi
WAzi=(F3WA+F1WA+F2WA)./sumzi
sumflare=F2PY+F2HY;
yPY=F2PY./sumflare;
yHY=F2HY./sumflare;
z=[IPzi;DEzi;ACzi;WAzi]
Ai=[18.6929 16.3417 18.3036 14.3145];
Bi=[3640.20 2895.73 3816.44 2756.22];
Ci=[-53.54 -43.15  -46.13 -45.09];
Patm=380;
T=linspace(60,70,11);
Tk=T+273.15;
for i=1:4
    Ki(i)=exp(Ai(i)-Bi(i)./(Ci(i)+Tk))/Patm;
end
Ki(4)=exp(Ai(4)-Bi(4)./(Ci(4)+Tk))/Patm*760/101.3
sum1=0.;
for i=1:4
    num=z(i).*(Ki(i)-1);
    denom=1+(Ki(i)-1)*v;
    sum1=sum1+num./denom;
end
y=sum1;
上述的函数是求 v的,Matlab显示的错误如下
???  In an assignment  A(I) = B, the number of elements in B and
I must be the same.

Error in ==> Profit at 34
    Ki(i)=exp(Ai(i)-Bi(i)./(Ci(i)+Tk))/Patm;
求高手帮帮啊,我在线等
回复
分享到:

使用道具 举报

发表于 2009-12-8 00:17 | 显示全部楼层
常见的程序出错问题整理 (eight), 13F
http://forum.vibunion.com/forum/thread-46001-1-1.html
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-26 07:48 , Processed in 0.052132 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表