matlab function函数的基础运算怎么只能得到一个结果。
Show older comments
本来应该得到p1,p2,Q,e,pim,pig,pimax的取值,但是结果只有p1,不知道哪里出了问题,求指导!!!!!
function[p1,p2,Q,e,pim,pig,pimax]=myfun(a,b,c,hm,hg,A,B,u,k,p0,T)
a=30.8;b=0.078;c=1.37;hm=0.3;hg=0.2;A=1135;B=3690;u=104;k=1.3;p0=500;T=90;
M=exp(c*T)-1;
N=T+(1-exp(c*T))/c;
E=M*p0*k+hm*M*T/2+hg*N+u*M;
p1=-(u*M+hg*N)/(2*M)+a*c*(T-N)/(2*M*b)+p0*k/2+hm*T/4;
p2=(M*p1)/(2*c*(T-N))+(u*M+hg*N)/(2*c*(T-N))+a/(2*b);
Q=(a-b*p2)*M/c;
e=((a-b*p2)*M)/(c*T);
pim=(p1-p0*k)*(a-b*p2)*M/c-hm*(a-b*p2)*M*T/(2*c)-B;
pig=p2*(a-b*p2)*(T-N)-hg*(a-b*p2)*N/c-(u+p1)*(a-b*p2)*M/c-A;
pimax=pim+pig;
end

这个结果应该是p1,而没有p2,Q,e,pim,pig,pimax
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB 快速入门 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!