声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1211|回复: 3

[编程技巧] 关于复矩阵求逆的问题

[复制链接]
发表于 2009-5-28 16:51 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
clear;
f=linspace(0,8000,100);  w=2.*pi.*f; c0=340;  p=2700;   h=0.0025;                                          
theta=linspace(0,pi/2,100); k0=w./c0;                                          
kx=k0.*sin(theta);   ky=k0.*cos(theta);  
%  define the compliance matrix s
S=[0.01 -0.0046 -0.0046 0 0 0;-0.0046 0.01 -0.0046 0 0 0; -0.0046 -0.0046 0.01 0 0 0;0 0 0 26.7 0 0;0 0 0 0 26.7 0;0 0 0 0 0 26.7];

% define the stiffness matrix C
C=inv(S);

D1=[1 0 0 0 0 0;0 0 0 0 0 1;0 0 0 0 1 0];
D2=[0 0 0 0 0 1;0 1 0 0 0 0;0 0 0 1 0 0];
D3=[0 0 0 0 1 0;0 0 0 1 0 0;0 0 1 0 0 0];

%Define the zero matrix and
A11=zeros(3); A12=eye(3); A=zeros(6,6,100);

%Define the I matrix
I0=zeros(3); I1=eye(3);

G=[0 0 0 1 0 0;0 0 0 0 1 0;0 0 1 0 0 0;0 1 0 0 0 0;1 0 0 0 0 0;0 0 0 0 0 1];
%calulate matrix A
B2=D3*C*(D3'); IVB2=inv(B2);

%Define the I matrix,the subscript in identical to the papers.
I11=[I1 I0;I0 I0]; I21=[I0 I0;I1 I0]; I12=[I0 I1;I0 I0]; I22=[I0 I0;I0 I1];

Itol=[I11 I21;I12 I22]; IVI=inv(Itol);

   for j = 1:length(w)
      B1(:,:,j)= (i*kx(j)*D1*C*D3')+(i*kx(j)*D3*C*D1')+(i*ky(j)*D2*C*D3')+(i*ky(j)*D3*C*D2');
      B0(:,:,j)=(i*kx(j)*i*kx(j)*D1*C*D1')+(i*ky(j)*i*ky(j)*D2*C*D2')+(i*kx(j)*i*ky(j)*D1*C*D2')+(i*ky(j)*i*kx(j)*D2*C*D1');
      A21(:,:,j)=-p*w(j)*w(j)*IVB2-IVB2*B0(:,:,j);
      A22(:,:,j)=-IVB2*B0(:,:,j);
      A(:,:,j)=[A11 A12;A21(:,:,j) A22(:,:,j)];
      H(:,:,j)=[i*kx(j)*C*D1'+i*ky(j)*C*D2',C*D3'];
      J(:,:,j)=expm(A(:,:,j));
      K(:,:,j)=inv(G)*H(:,:,j)*J(:,:,j);
      L(:,:,j)=inv(G*I21- H(:,:,j)*I21)
   end

请问下高手,我这个程序在计算L矩阵的时候,没办法运行了,在计算复矩阵 G*I21- H(:,:,j)*I21出错,是什么原因,该如何解决
在我计算机上Matlab的错误代码
??? Function 'inv' is not defined for values of class 'double' and attributes 'full 3d complex'.

[ 本帖最后由 ChaChing 于 2010-3-30 21:30 编辑 ]
回复
分享到:

使用道具 举报

发表于 2009-5-28 18:06 | 显示全部楼层
能运行,但不可求逆:

L =

   Inf   Inf   Inf   Inf   Inf   Inf
   Inf   Inf   Inf   Inf   Inf   Inf
   Inf   Inf   Inf   Inf   Inf   Inf
   Inf   Inf   Inf   Inf   Inf   Inf
   Inf   Inf   Inf   Inf   Inf   Inf
   Inf   Inf   Inf   Inf   Inf   Inf

K>> G*I21- H(:,:,j)*I21

ans =

    1.0000         0 -393.8356         0         0         0
         0    1.0000 -393.8356         0         0         0
         0         0 -462.3288         0         0         0
         0   -0.0375         0         0         0         0
   -0.0375         0         0         0         0         0
         0         0    1.0000         0         0         0
此时:
K>> det(ans)
ans =
     0

评分

1

查看全部评分

 楼主| 发表于 2009-5-29 12:10 | 显示全部楼层
matlab可以直接求复矩阵行列式不?
发表于 2009-5-29 15:49 | 显示全部楼层

回复 板凳 wusemm 的帖子

试一下不就知道了吗
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-22 12:58 , Processed in 0.074291 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表