24小时热门版块排行榜    

CyRhmU.jpeg
查看: 545  |  回复: 7
当前主题已经存档。
【有奖交流】积极回复本帖子,参与交流,就有机会分得作者 yatlan 的 4 个金币

yatlan

新虫 (初入文坛)

[交流] 【求助】matlab 求解方程组时 出错,非常急,好心人帮忙!

clear;
syms  a b c d e cl cz ll lz cll lll czl lzl;
a=ll*lz*cl*cz;
b=ll*cl+lz*cz+lz*cl;
c=ll*lz*cl;
d=lz;
e=(b+(b^2-4*a)^(1/2))/2;
cll=(a*(a-e^2))/(e*(a*d-c*e))-3.071;
lll=(a*d-c*e)/(a-e^2)-7.533;
czl=(a-e^2)/(c-d*e)-1.313;
lzl=(e*(c-d*e))/(a-e^2)-3.222;
solve(cll,lll,czl,lzl);

如上的程序在最后solve 求解时提示
??? Error using ==> subsref
Index exceeds matrix dimensions.

Error in ==> sym.subsref at 16
  y = builtin('subsref',struct(x),a);

Error in ==> solve at 191
      S.(char(symvars(j))) = R(:,j);

再线等................!  
非常感谢
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

bote

sorry for some confusiion?

★ ★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
sunxiao(金币+2,VIP+0):thank you for your suggestions 10-3 00:13
1. seems using solve(cll,lll,czl,lzl, 'cz', 'cl', 'lz', 'll')

have tried a simple case like what you are going to do. it works.
the code is as follows:

clear;
clc;
syms a u v;
l=a*u^2 + v^2;
m=u-v-1;
n=a^2-5*a+6;
A=solve(l,m,n, 'a','u','v');

therefore, it seems that your equations are too complicated for the matlab. maybe, the other approaches had to be considered, such as simplify your equations first.
anyway, show it up here if you solve the problem. good luck.

again: if you remove only one denominator from any one of your four equations, the code can run through to the end after replacing the solve function with the one given above. so, you had to simplify your equations first.

[ Last edited by bote on 2009-10-2 at 12:27 ]
2楼2009-10-02 06:28:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

buffalo7239

至尊木虫 (著名写手)

★ ★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
sunxiao(金币+2,VIP+0):谢谢参与,欢迎常来 10-3 00:13
我帮你运行了一下,我的MATLAB7.0没有出错,仅出现警告,可能你的版本过低。结果如下:
Warning: Explicit solution could not be found.
> In solve at 140
  In sym.solve at 49
  In Untitled at 12
3楼2009-10-02 08:23:25
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

buffalo7239

至尊木虫 (著名写手)

★ ★
sunxiao(金币+2,VIP+0):谢谢参与,欢迎常来 10-3 00:15
你的思想是干嘛,说清楚,解出来的结果,abcde跟你写的一样。如:
a =

ll*lz*cl*cz
4楼2009-10-02 08:26:56
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yatlan

新虫 (初入文坛)

1.其实这是一个电路的变换.[ll,lz,cl,cz] 是我最终要求出来的结果, a,b,c,d,e是中间变量 ,cll,lll,czl,lzl是已知的方程表达式,我利用matlab 将中间变量带入到最终方程中.即使 我没有加入中间变量,就是利用最终方程求解a,c,d,e,在我这里一样提示同样的错误.
2.我用的是matlab 2008b,难道这个版本有问题吗?
5楼2009-10-02 10:46:28
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

buffalo7239

至尊木虫 (著名写手)

也可能你有的工具箱没有安装,我抽空再帮你看看程序。今天中秋,祝中秋愉快!
6楼2009-10-03 09:00:50
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

eaglefy

木虫 (正式写手)

★ ★ ★
yatlan(金币+3,VIP+0):非常感谢您的帮忙!!!3个金币的小礼物 10-3 21:07
好像是无解,仔细检查一下方程
相信自己,融入团队 追求卓越,挑战极限 实现自我,创造价值
7楼2009-10-03 10:01:20
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yatlan

新虫 (初入文坛)

。。。。。。。。。。。。。。。。
如果是没有解析解的话,我如何给出数值解呢?
8楼2009-10-03 21:08:37
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 yatlan 的主题更新
普通表情 高级回复(可上传附件)
信息提示
请填处理意见