| 查看: 1354 | 回复: 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 |
» 猜你喜欢
交叉科学部支持青年基金,对三无青椒是个机会吗?
已经有7人回复
青椒八年已不青,大家都被折磨成啥样了?
已经有15人回复
多组分精馏求助
已经有4人回复
免疫学博士有名额,速联系
已经有4人回复
国家基金申请书模板内插入图片不可调整大小?
已经有6人回复
国家级人才课题组招收2026年入学博士
已经有5人回复
Fe3O4@SiO2合成
已经有6人回复
青年基金C终止
已经有4人回复
26申博求博导推荐-遥感图像处理方向
已经有4人回复
» 本主题相关价值贴推荐,对您同样有帮助:
矩阵A*B=0 如果已知矩阵B和矩阵A的维数,如何求矩阵A
已经有11人回复
求助一个简单的矩阵行列式问题~~~
已经有12人回复
Mathematica求30乘30矩阵的行列式为何得不到结果,求指教
已经有4人回复
hytao2012
铁杆木虫 (正式写手)
木头虫子
- 应助: 53 (初中生)
- 金币: 6329.8
- 散金: 115
- 红花: 11
- 帖子: 479
- 在线: 206.3小时
- 虫号: 2050091
- 注册: 2012-10-08
- 性别: GG
- 专业: 固体力学
2楼2014-11-02 09:49:16
3楼2014-11-02 10:57:12
hytao2012
铁杆木虫 (正式写手)
木头虫子
- 应助: 53 (初中生)
- 金币: 6329.8
- 散金: 115
- 红花: 11
- 帖子: 479
- 在线: 206.3小时
- 虫号: 2050091
- 注册: 2012-10-08
- 性别: GG
- 专业: 固体力学
4楼2014-11-02 11:33:02
5楼2014-11-02 12:52:58
hytao2012
铁杆木虫 (正式写手)
木头虫子
- 应助: 53 (初中生)
- 金币: 6329.8
- 散金: 115
- 红花: 11
- 帖子: 479
- 在线: 206.3小时
- 虫号: 2050091
- 注册: 2012-10-08
- 性别: GG
- 专业: 固体力学
6楼2014-11-02 15:01:27













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