24小时热门版块排行榜    

查看: 2081  |  回复: 6

jrflower

木虫 (正式写手)

[求助] 求matlab求解一个方程组的问题

想用matlab求解一个包含3个式子的方程组,结果没算出来,不知道是怎么回事,我对matlab了解非常少,想着应该是我写的式子有问题,请有经验的朋友帮帮忙
solve('1/4596.75-8.31446/716700*log(a)=1/4435.46-8.31446/837700*log(b)', '1/4435.46-8.31446/837700*log(b)=1/4097.94-8.31446/820000*log(c)', 'a+b+c=1')

要求出a,b,c的值
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖


jrflower(金币+20): 谢谢 2011-11-17 22:29:59
余泽成(金币+1): 谢谢参与应助! 2011-11-19 14:27:53
[a,b,c]=solve('1/4596.75-8.31446/716700*log(a)=1/4435.46-8.31446/837700*log(b)', '1/4435.46-8.31446/837700*log(b)=1/4097.94-8.31446/820000*log(c)', 'a+b+c=1','a','b','c')

a =

0.08346430589202496974797491804609


b =

0.12177617993836521593616873649657


c =

0.79475951416960981431585634545734
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2011-11-17 22:12:06
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jrflower

木虫 (正式写手)

引用回帖:
2楼: Originally posted by dbb627 at 2011-11-17 15:12:06:
[a,b,c]=solve('1/4596.75-8.31446/716700*log(a)=1/4435.46-8.31446/837700*log(b)', '1/4435.46-8.31446/837700*log(b)=1/4097.94-8.31446/820000*log(c)', 'a+b+c=1','a','b','c')

a =

0.083464305892 ...

十分感谢,这个结果肯定是对的。可是为什么我把你的式子复制到matlab里面就算不出来呢,得到下面的结果
>> [a,b,c]=solve('1/4596.75-8.31446/716700*log(a)=1/4435.46-8.31446/837700*log(b)', '1/4435.46-8.31446/837700*log(b)=1/4097.94-8.31446/820000*log(c)', 'a+b+c=1','a','b','c')
Warning: Explicit solution could not be found.
> In solve at 140

a =

[ empty sym ]



b =

     []


c =

     []
请帮我看看这是怎么回事,另外我求解这个方程
x=solve('exp(1/8.31446*(1/4596.75-1/4435.46)+1/837700*log(x))*716700+exp(1/8.31446*(1/4097.94-1/4435.46)+1/837700*log(x))*820000+x-1')也求解不出来,也请帮我看看是什么问题吧
3楼2011-11-17 22:29:02
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖


jjdg(金币+1): 感谢参与 2011-11-18 01:06:58
可能是matlab版本的问题
我的是2010b
x=solve('exp(1/8.31446*(1/4596.75-1/4435.46)+1/837700*log(x))*716700+exp(1/8.31446*(1/4097.94-1/4435.46)+1/837700*log(x))*820000+x-1','x')
Warning: Explicit solution could not be found.
> In solve at 81

x =

[ empty sym ]
画图可知 没有解满足条件
ezplot('exp(1/8.31446*(1/4596.75-1/4435.46)+1/837700*log(x))*716700+exp(1/8.31446*(1/4097.94-1/4435.46)+1/837700*log(x))*820000+x-1')
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
4楼2011-11-17 22:39:41
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jrflower

木虫 (正式写手)

引用回帖:
4楼: Originally posted by dbb627 at 2011-11-17 15:39:41:
可能是matlab版本的问题
我的是2010b
x=solve('exp(1/8.31446*(1/4596.75-1/4435.46)+1/837700*log(x))*716700+exp(1/8.31446*(1/4097.94-1/4435.46)+1/837700*log(x))*820000+x-1','x')
Warning: Explicit s ...

我的版本很老,是matlab7.0,难道需要在开始把a,b,c设置一下类型,比如syms a b c, real a b c,什么的,[ empty sym ]是不是当成一个矩阵什么了,不知道怎么解决,另外看网上还有一个fsolve和fzero的命令,也是求解方程的,不知道是不是该用这两个命令
5楼2011-11-17 23:48:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)


jjdg(金币+1): 感谢参与 2011-11-18 01:06:49
[ empty sym ]是空的符号矩阵

fsolve和fzero的命令是求数值解的
你可以用help fsolve查看用法

f=@(x)exp(1/8.31446*(1/4596.75-1/4435.46)+1/837700*log(x))*716700+exp(1/8.31446*(1/4097.94-1/4435.46)+1/837700*log(x))*820000+x-1;
fsolve(f,0)
解出来的结果也不对
估计因为你那方程就没有解
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
6楼2011-11-17 23:56:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jrflower

木虫 (正式写手)

引用回帖:
6楼: Originally posted by dbb627 at 2011-11-17 16:56:55:
[ empty sym ]是空的符号矩阵

fsolve和fzero的命令是求数值解的
你可以用help fsolve查看用法

f=@(x)exp(1/8.31446*(1/4596.75-1/4435.46)+1/837700*log(x))*716700+exp(1/8.31446*(1/4097.94-1/4435.46) ...

第二个方程是我搞错了,里面少了括号,应该是
>> x=fsolve('exp((1/8.31446*(1/4596.75-1/4435.46)+1/837700*log(x))*716700)+exp((1/8.31446*(1/4097.94-1/4435.46)+1/837700*log(x))*820000)+x-1',0.13)
Optimization terminated: first-order optimality is less than options.TolFun.

x =

    0.1218
解出来和第一个方程组你帮我解出来的b值相等,这个式子就是我把前面的方程组合并了一下求的b
7楼2011-11-18 00:12:30
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 jrflower 的主题更新
信息提示
请填处理意见