woaiwo 发表于 2013-6-17 14:35

求解一个行列式中未知数的值

syms r
k1=2;
k=2;
k2=2;
t=3;
L=1;
L1=0.4;
C=[1,0,-1,0,0,0,0,0;
   k1,t*r^3,k1,-t*r^3,0,0,0,0;
   0,0,0,0,cosh(r*L),sinh(r*L),-cos(r*L),-sin(r*L);
   0,0,0,0,t*sinh(r*L)*r^3-k2*cosh(r*L),t*cosh(r*L)*r^3-k2*sinh(r*L),t*sin(r*L)*r^3-k2*cos(r*L),-t*cos(r*L)*r^3-k2*sin(r*L);
   cosh(r*L1),sinh(r*L1),cos(r*L1),sin(r*L1),-cosh(r*L1),-sinh(r*L1),-cos(r*L1),-sin(r*L1);
   cosh(r*L1),sinh(r*L1),-cos(r*L1),-sin(r*L1),-cosh(r*L1),-sinh(r*L1),cos(r*L1),sin(r*L1)*r^2;
   t*sinh(r*L1)*r^3+k*cosh(r*L1),t*cosh(r*L1)*r^3+k*sinh(r*L1),t*sin(r*L1)*r^3+k*cos(r*L1),-t*cos(r*L1)*r^3+k*sin(r*L1),-t*sinh(r*L1)*r^3,-t*cosh(r*L1)*r^3,-t*sin(r*L1)*r^3,t*cos(r*L1)*r^3;
   sinh(r*L1),cosh(r*L1),-sin(r*L1),cos(r*L1),-sinh(r*L1),-cosh(r*L1),sin(r*L1),-cos(r*L1)]
怎么求解未知数r?我用的是det(C)和solve但是求不出解来,求指导!


米斯兰达 发表于 2013-6-17 15:35

楼主 稍微改了一下你的求解思路
1、不用符号计算了 改成匿名函数
2、因为只计算r一个未知数 看做的关于r的一元函数 所以采用了fzero来求解 初始值设置的为随机(rand)

程序如下:

>> k1=2;
k=2;
k2=2;
t=3;
L=1;
L1=0.4;
>> y=@(r)det([1,0,-1,0,0,0,0,0;
   k1,t*r^3,k1,-t*r^3,0,0,0,0;
   0,0,0,0,cosh(r*L),sinh(r*L),-cos(r*L),-sin(r*L);
   0,0,0,0,t*sinh(r*L)*r^3-k2*cosh(r*L),t*cosh(r*L)*r^3-k2*sinh(r*L),t*sin(r*L)*r^3-k2*cos(r*L),-t*cos(r*L)*r^3-k2*sin(r*L);
   cosh(r*L1),sinh(r*L1),cos(r*L1),sin(r*L1),-cosh(r*L1),-sinh(r*L1),-cos(r*L1),-sin(r*L1);
   cosh(r*L1),sinh(r*L1),-cos(r*L1),-sin(r*L1),-cosh(r*L1),-sinh(r*L1),cos(r*L1),sin(r*L1)*r^2;
   t*sinh(r*L1)*r^3+k*cosh(r*L1),t*cosh(r*L1)*r^3+k*sinh(r*L1),t*sin(r*L1)*r^3+k*cos(r*L1),-t*cos(r*L1)*r^3+k*sin(r*L1),-t*sinh(r*L1)*r^3,-t*cosh(r*L1)*r^3,-t*sin(r*L1)*r^3,t*cos(r*L1)*r^3;
   sinh(r*L1),cosh(r*L1),-sin(r*L1),cos(r*L1),-sinh(r*L1),-cosh(r*L1),sin(r*L1),-cos(r*L1)]);
>> s=fzero(y,rand)

s =

    0.8897

>>

最后问一句:楼主你是要求|C|=0不?

woaiwo 发表于 2013-6-17 16:32

本帖最后由 woaiwo 于 2013-6-17 16:34 编辑

米斯兰达 发表于 2013-6-17 15:35 static/image/common/back.gif
楼主 稍微改了一下你的求解思路
1、不用符号计算了 改成匿名函数
2、因为只计算r一个未知数 看做的关于r的 ...
对对,不好意思,忘写了。太感谢你了。再问一下,这个r只有一个解吗?
页: [1]
查看完整版本: 求解一个行列式中未知数的值