zhj 发表于 2009-8-14 22:34

求助:怎么用matlab求解联立方程组啊

求助:急用:我想用matlab求解两个方程p1和Mcr,这两个方程里含有两个未知数x和gama,其他都是已知的值。我用了solve,可是结果总是显示empty空值,不知道是什么原因。望高手们能给以指点啊,我附上源程序,希望帮我解决一下这个问题了!谢谢了!
这里面的两个方程就是p1和Mcr让它们为零就可以了。
clc;clear;
syms gama ftk x
%x=685.2076;
%gama=1.0;
N=1600000; As=763; As1=66; b=115; hw=1000;
%Mcr=6E8;
Es=200000; Ec=38000; ftk=4.42; epsilontu=120.2E-6;
%ftk=Ec*epsilontu/gama;
phy=epsilontu/(hw-x);
as=((990-x)*339*10+(930-x)*226*70+(870-x)*66*130+(810-x)*66*190+(750-x)*66*250)/((990-x)*339+(930-x)*226+(870-x)*66+(810-x)*66+(750-x)*66)
epsilons=(hw-as-x)*phy; epsilons1=(650-x)*phy;
sigmas=Es*phy*(hw-as-x); sigmas1=epsilons1*Es;
Tc=0.5*gama*ftk*(hw-x)*b, Ts=Es*phy*(hw-as-x)*As, Ts1=sigmas1*As1
asp=as;
Asp=763; As1p=66; As2p=66; As3p=66;
epsilonsp=(x-asp)*phy; epsilons1p=phy*(x-350); epsilons2p=phy*(x-450); epsilons3p=phy*(x-550);
sigmasp=epsilonsp*Es; sigmas1p=Es*epsilons1p; sigmas2p=Es*epsilons2p; sigmas3p=Es*epsilons3p;
Tsp=(x-asp)*phy*Asp*Es, Cc=x*x*gama*ftk/(2*(hw-x))*b
Ts1p=sigmas1p*As1p, Ts2p=sigmas2p*As2p, Ts3p=sigmas3p*As3p

%p1=N+Tc+Ts-Tsp-Cc
p1=N+Tc+Ts+Ts1-Tsp-Cc-Ts1p-Ts2p-Ts3p
%p1=1600000+7.072*(1000-x)+(1.346e8*(1000-as-x)+13200000*(650-x)-134600000*(x-asp)-13200000*(x-350)-13200000*(x-450)-13200000*(x-550))*120.2e-6/(1000-x)-7.072*x^2/(1000-x)
%solve('N+Tc+Ts+Ts1-Tsp-Cc-Ts1p-Ts2p-Ts3p=0','x')
Mcr=Ts*(hw/2-as)+Tc*(hw/2-(hw-x)/3)+Ts1*150-Ts1p*50+Ts2p*50+Ts3p*150+Tsp*(hw/2-asp)+Cc*(hw/2-x/3)

[ 本帖最后由 ChaChing 于 2009-8-14 23:01 编辑 ]

ChaChing 发表于 2009-8-15 01:08

原帖由 zhj 于 2009-8-14 22:34 发表 http://www.chinavib.com/forum/images/common/back.gif
...两个方程p1和Mcr,这两个方程里含有两个未知数x和gama,其他都是已知的值。我用了solve...
时间有限, 无法细看LZ的程序! sorry
两个方程两个未知数, 不就是典型的Ax=b ?
为何一定要用symbolic不能用数值解吗?==> x=A\b

zhj 发表于 2009-8-15 10:29

回复 板凳 ChaChing 的帖子

主要是那两个方程里面同时含有x和gama两个变量,很长的式子。我没办法把它化简成那种很明显的形式。
p1=(14291182625542246875*(x - 350))/(9007199254740992*(x - 1000)) + (14291182625542246875*(x - 450))/(9007199254740992*(x - 1000)) + (14291182625542246875*(x - 550))/(9007199254740992*(x - 1000)) + (14291182625542246875*(x - 650))/(9007199254740992*(x - 1000)) + (330429464948143465625*(x - (56830*x - 48065700)/(763*x - 706170)))/(18014398509481984*(x - 1000)) + (330429464948143465625*(x + (56830*x - 48065700)/(763*x - 706170) - 1000))/(18014398509481984*(x - 1000)) - (5083*gama*(x - 1000))/20 + (5083*gama*x^2)/(10*(2*x - 2000)) + 1600000
Mcr=(357279565638556171875*(x - 350))/(4503599627370496*(x - 1000)) - (357279565638556171875*(x - 450))/(4503599627370496*(x - 1000)) - (1071838696915668515625*(x - 550))/(4503599627370496*(x - 1000)) + (1071838696915668515625*(x - 650))/(4503599627370496*(x - 1000)) + (330429464948143465625*(x - (56830*x - 48065700)/(763*x - 706170))*((56830*x - 48065700)/(763*x - 706170) - 500))/(18014398509481984*(x - 1000)) - (330429464948143465625*((56830*x - 48065700)/(763*x - 706170) - 500)*(x + (56830*x - 48065700)/(763*x - 706170) - 1000))/(18014398509481984*(x - 1000)) - (5083*gama*(x/3 + 500/3)*(x - 1000))/20 + (5083*gama*x^2*(x/3 - 500))/(10*(2*x - 2000))
这是最后的两个方程。怎么解啊?

ChaChing 发表于 2009-8-15 10:55

=solve(p1,Mcr,'x','gama')

friendchj 发表于 2009-8-15 10:58

clc
clear
syms x gama
p1=(14291182625542246875*(x - 350))/(9007199254740992*(x - 1000)) + ...
(14291182625542246875*(x - 450))/(9007199254740992*(x - 1000)) + ...
(14291182625542246875*(x - 550))/(9007199254740992*(x - 1000)) + ...
(14291182625542246875*(x - 650))/(9007199254740992*(x - 1000)) + ...
(330429464948143465625*(x - (56830*x - 48065700)/(763*x - 706170)))/(18014398509481984*(x - 1000)) + ...
(330429464948143465625*(x + (56830*x - 48065700)/(763*x - 706170) - 1000))/(18014398509481984*(x - 1000)) -...
(5083*gama*(x - 1000))/20 + (5083*gama*x^2)/(10*(2*x - 2000)) + 1600000;
Mcr=(357279565638556171875*(x - 350))/(4503599627370496*(x - 1000)) - ...
(357279565638556171875*(x - 450))/(4503599627370496*(x - 1000)) - ...
(1071838696915668515625*(x - 550))/(4503599627370496*(x - 1000)) + ...
(1071838696915668515625*(x - 650))/(4503599627370496*(x - 1000)) + ...
(330429464948143465625*(x - (56830*x - 48065700)/(763*x - 706170))*((56830*x - 48065700)/...
(763*x - 706170) - 500))/(18014398509481984*(x - 1000)) - ...
(330429464948143465625*((56830*x - 48065700)/(763*x - 706170) - 500)*(x + ...
(56830*x - 48065700)/(763*x - 706170) - 1000))/(18014398509481984*(x - 1000)) - ...
(5083*gama*(x/3 + 500/3)*(x - 1000))/20 + (5083*gama*x^2*(x/3 - 500))/(10*(2*x - 2000));
y=solve(p1,Mcr)
>> vpa(y.gama,3)

ans =

         -.2
.5-.56e-1*i
.5+.56e-1*i


>> vpa(y.x,3)

ans =

      .100e4
929.+6.55*i
929.-6.55*i
页: [1]
查看完整版本: 求助:怎么用matlab求解联立方程组啊