| 查看: 1479 | 回复: 5 | ||
[求助]
提示矩阵维数必须一致,不清楚在哪里编程出现了错误,求指教 已有1人参与
|
|
function ff4 clc Data=[ 303.15 0.7766 0.02522 313.15 0.7702 0.02548 323.15 0.7605 0.02683 333.15 0.7534 0.02740]; T=Data(:,1); x11=Data(:,2); x12=Data(:,3); [A,fval]=fminsearch(@func3,[1,1],[],T,x11,x12) x11cal=func1(A,T,x11,x12) x12cal=func2(A,T,x11,x12) end function y=func1(A,T,x11,x12) A12=A(1); A21=A(2); alfa=0.2; R=8.314; tao12=A12./R./T; tao21=A21./R./T; G12=exp(-alfa*tao12); G21=exp(-alfa*tao21); x21=1-x11; x22=1-x12; gama11=exp(x21.^2.*(tao21.*(G21./(x11+x21.*G21)).^2+tao12.*G12./(x21+x11.*G12).^2)); gama12=exp(x22.^2.*(tao21.*(G21./(x12+x22.*G21)).^2+tao12.*G12./(x22+x12.*G12).^2)); gama21=exp(x11.^2.*(tao12.*(G12./(x21+x11.*G12)).^2+tao21.*G21./(x11+x21.*G21).^2)); gama22=exp(x12.^2.*(tao12.*(G12./(x22+x12.*G12)).^2+tao21.*G21./(x12+x22.*G21).^2)); y=(gama12.*gama22)/(gama11.*gama22-gama12.*gama21)-(gama12.*gama21)/(gama11.*gama22-gama12.*gama21); end function y=func2(A,T,x11,x12) A12=A(1); A21=A(2); alfa=0.2; R=8.314; tao12=A12./R./T; tao21=A21./R./T; G12=exp(-alfa*tao12); G21=exp(-alfa*tao21); x21=1-x11; x22=1-x12; gama11=exp(x21.^2.*(tao21.*(G21./(x11+x21.*G21)).^2+tao12.*G12./(x21+x11.*G12).^2)); gama12=exp(x22.^2.*(tao21.*(G21./(x12+x22.*G21)).^2+tao12.*G12./(x22+x12.*G12).^2)); gama21=exp(x11.^2.*(tao12.*(G12./(x21+x11.*G12)).^2+tao21.*G21./(x11+x21.*G21).^2)); gama22=exp(x12.^2.*(tao12.*(G12./(x22+x12.*G12)).^2+tao21.*G21./(x12+x22.*G21).^2)); y=(gama11.*gama22)/(gama11.*gama22-gama12.*gama21)-(gama11.*gama21)/(gama11.*gama22-gama12.*gama21); end function y=func3(A,T,x11,x12) x11cal=func1(A,T,x11,x12); x12cal=func2(A,T,x11,x12); sigma=sum((x11-x11cal).^2+(x12-x12cal).^2); y=sigma; format long g end |
» 猜你喜欢
基于自然哲学类比的风化壳型稀土矿
已经有14人回复
国自然申请五篇代表作大比拼,感觉这个是最重要的
已经有7人回复
评委有多少概率知道其他专家手中有哪些人的本子?
已经有6人回复
求推荐期刊,重谢
已经有3人回复
职称论文投稿
已经有7人回复
中!中!中!
已经有4人回复
E0414, 我的本子有没有希望?
已经有17人回复
青A35岁以下通知答辩了吗
已经有4人回复
小城的小雨
已经有3人回复
看《给阿ma的情书》有感
已经有5人回复
» 本主题相关价值贴推荐,对您同样有帮助:
矩阵A*B=0 如果已知矩阵B和矩阵A的维数,如何求矩阵A
已经有11人回复
求助一个简单的矩阵行列式问题~~~
已经有12人回复
Mathematica求30乘30矩阵的行列式为何得不到结果,求指教
已经有4人回复
hytao2012
铁杆木虫 (正式写手)
木头虫子
- 应助: 53 (初中生)
- 金币: 6413.8
- 散金: 115
- 红花: 11
- 帖子: 490
- 在线: 207.9小时
- 虫号: 2050091
- 注册: 2012-10-08
- 性别: GG
- 专业: 固体力学
2楼2014-11-02 09:49:16
3楼2014-11-02 10:57:12
hytao2012
铁杆木虫 (正式写手)
木头虫子
- 应助: 53 (初中生)
- 金币: 6413.8
- 散金: 115
- 红花: 11
- 帖子: 490
- 在线: 207.9小时
- 虫号: 2050091
- 注册: 2012-10-08
- 性别: GG
- 专业: 固体力学
4楼2014-11-02 11:33:02
5楼2014-11-02 12:52:58
hytao2012
铁杆木虫 (正式写手)
木头虫子
- 应助: 53 (初中生)
- 金币: 6413.8
- 散金: 115
- 红花: 11
- 帖子: 490
- 在线: 207.9小时
- 虫号: 2050091
- 注册: 2012-10-08
- 性别: GG
- 专业: 固体力学
6楼2014-11-02 15:01:27











回复此楼
小指甲123
还是你自己找到问题的所在啊