Matlab
2008-07-26, 22:05
解三元方程组,其中一个量不能显示数值解,但另外两个可以出来。下面是我的程序(只截取了出不来解的),请高手帮忙看一下,是溢出了么,是程序的原因,还是输入的变量解不出来有效的解?(我试着瞎输入几个数,还是出不来解)多谢了!
>> clear
syms R L w1 w2 a1 b1 b2 Ls
[R,L,Ls]=solve('-a1*R^2-a1*w1^2*L^2+R=0','(R^2+w1^2*L^2)/w1*Ls+b1*(R^2+w1^2*L^2)+w1*L=0','(R^2+w2^2*L^2)/w2*Ls+b2*(R^2+w2^2*L^2)+w2*L=0','R','L','Ls');
%%%%%%%%%%%%%%%%%%%%%%%%%%%
z1=subs(L,'w1',input('Please input w1:'));
z2=subs(z1,'b1',input('Please input b1:'));
z3=subs(z2,'a1',input('Please input a1:'));
z4=subs(z3,'b2',input('Please input b2:'));
L=subs(z4,'w2',input('Please input w2:'))
Please input w1:314
Please input b1:-0.1027
Please input a1:0.1895
Please input b2:-0.0765
Please input w2:78.5
Warning: Out of range or non-integer values truncated during conversion to character.
> In sym.subs at 127
L =
-24649*(-21339300977334096754547229773/10981127840000000000-18262240969789/1098112784000000000000000000*40472347990612767276922607153189^(1/2)*400000000000000^(1/2))/(28485745895700016674297556991/2196225568000000+22384416285399/219622556800000000000000*40472347990612767276922607153189^(1/2)*400000000000000^(1/2))
-24649*(-21339300977334096754547229773/10981127840000000000+18262240969789/1098112784000000000000000000*40472347990612767276922607153189^(1/2)*400000000000000^(1/2))/(28485745895700016674297556991/2196225568000000-22384416285399/219622556800000000000000*40472347990612767276922607153189^(1/2)*400000000000000^(1/2))
Ls
>> clear
syms R L w1 w2 a1 b1 b2 Ls
[R,L,Ls]=solve('-a1*R^2-a1*w1^2*L^2+R=0','(R^2+w1^2*L^2)/w1*Ls+b1*(R^2+w1^2*L^2)+w1*L=0','(R^2+w2^2*L^2)/w2*Ls+b2*(R^2+w2^2*L^2)+w2*L=0','R','L','Ls');
%%%%%%%%%%%%%%%%%%%%%%%%%%%
z1=subs(L,'w1',input('Please input w1:'));
z2=subs(z1,'b1',input('Please input b1:'));
z3=subs(z2,'a1',input('Please input a1:'));
z4=subs(z3,'b2',input('Please input b2:'));
L=subs(z4,'w2',input('Please input w2:'))
Please input w1:314
Please input b1:-0.1027
Please input a1:0.1895
Please input b2:-0.0765
Please input w2:78.5
Warning: Out of range or non-integer values truncated during conversion to character.
> In sym.subs at 127
L =
-24649*(-21339300977334096754547229773/10981127840000000000-18262240969789/1098112784000000000000000000*40472347990612767276922607153189^(1/2)*400000000000000^(1/2))/(28485745895700016674297556991/2196225568000000+22384416285399/219622556800000000000000*40472347990612767276922607153189^(1/2)*400000000000000^(1/2))
-24649*(-21339300977334096754547229773/10981127840000000000+18262240969789/1098112784000000000000000000*40472347990612767276922607153189^(1/2)*400000000000000^(1/2))/(28485745895700016674297556991/2196225568000000-22384416285399/219622556800000000000000*40472347990612767276922607153189^(1/2)*400000000000000^(1/2))
Ls