24小时热门版块排行榜    

查看: 843  |  回复: 1

1312758691

新虫 (小有名气)

[求助] Undefined function 'norm' for input arguments of type 'sym'. 已有1人参与

clear;
clc;
S1=[100 300 0];          %the compositions of stream1:N2,H2,NH3
S60=[70 210 1];          %the initial compositions of stream6:N2,H2,NH3
K=0.5;                   %equilibrium constant
P=200*101.325;           %pressure of reaction,KPa
P0=100                   %stander pressure,KPa
tol=0.00001;             %tolerance
%-----------------------------------------------------------------------
%calculate the compositions of stream2:N2,H2,NH3
S2=S1+S60;
%calculate the proportion of a=H2:N2 in the stream2
a=S2(2)/S2(1);
X=solve('K*P*(1-x)^0.5*(a-3*x)^1.5==2*x*(a+1-2*x)*P0');
%calculate the compositions of stream3,stream4,stream5,stream6
delta=-X*S2(1);         %the changement of N2
S3=[delta 3*delta -2*delta];
S4=S2+S3;
S5=[0.005*S4(1) 0.005*S4(2) 0.98*S4(3)];
S6=S4-S5;
%-----------------------------------------------------------------------
%-----------------------------------------------------------------------
%iterative computation
delta_S=S6-S60;
while(norm(delta_S))>tol
      S60=S6;
      S2=S1+S60;
      a=S2(2)/S2(1);
      X=solve('K*P*(1-x)^0.5*(a-3*x)^1.5==2*x*(a+1-2*x)*P0');
      delta=-X*S2(1);         
      S3=[delta 3*delta -2*delta];
      S4=S2+S3;
      S5=[0.005*S4(1) 0.005*S4(2) 0.98*S4(3)];
      S6=S4-S5;
      delta_S=S6-S60;
end
S=[S1;S2;S3;S4;S5;S6]



运行程序出现这样的错误:Undefined function 'norm' for input arguments of type 'sym'.
                                          Error in NH3 (line 25)
                                          while(norm(delta_S))>tol

不知道为什么出现这样的错误,求大侠帮忙解决!谢谢~~~
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

eidie

木虫之王 (文坛精英)

文献杰出贡献

【答案】应助回帖

delta_S变量是一个符号变量,用norm求该向量的模也必须先转化成数值形式。
跟一个女博士相亲,我问她:“你学历这么高,嫁的出去吗?”她说:“这个问题,等我回去写篇论文回答你。”
2楼2015-04-07 09:28:54
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 1312758691 的主题更新
信息提示
请填处理意见