| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1900 人关注过本帖
标题:[求助]解矩阵时总是out of memory
取消只看楼主 加入收藏
huhan508
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-8-22
收藏
 问题点数:0 回复次数:1 
[求助]解矩阵时总是out of memory
本人是新手,在用matlab编程解3x3变量矩阵时总是out of memory,矩阵是对称矩阵,有六个变量。我是不是必须添加内存?或者用别的方法编程,请高手指点,谢谢!
搜索更多相关主题的帖子: memory 解矩阵 内存 变量 
2007-08-27 20:44
huhan508
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-8-22
收藏
得分:0 

这是已知矩阵,

A =

[ 418.1625, 12.4299, 0, 0, 0, 0 ]
[ 12.4299, 35.4397, 0, 0, 0, 0 ]
[ 0, 0, 0, 0, 0, 0 ]
[ 0, 0, 0, 12.5800, 0, 0 ]
[ 0, 0, 0, 0, 3.4000*C_55, 0 ]
[ 0, 0, 0, 0, 0, 18.3600]



D =

[ 402.8299, 11.9742, 0, 0, 0, 0 ]
[ 11.9742, 34.1403, 0, 0, 0, 0 ]
[ 0, 0, 0, 0, 0, 0 ]
[ 0, 0, 0, 12.1187, 0, 0 ]
[ 0, 0, 0, 0, 3.2753*C_55, 0 ]
[ 0, 0, 0, 0, 0, 17.6868]


下面是程序,


i=sqrt(-1);
rho=0.0000015;
h=3.4;
f = (1:22); % Frequencies for which experimental results of cg are available
%---------------- -------------------------------------------------------
ka1=sqrt(pi^2/12); % shear correction factor
%--------------------------------------------------------------------------
I0= rho*2*h/2; % intergal of I0 with (-z,z) interval.
I2= rho*2*(h/2)^3/3; % intergal of I2 with (-z,z) interval.
%--------------------------------------------------------------------------
% Symbolic expresion used to perform Algebraic calculation


phi = 0; % Propagation wave angle

for phi_i=phi:phi+1
syms C_55;
syms k ;
syms omega;


c=cos(phi_i/360*2*pi );
s=sin(phi_i/360*2*pi );


if phi_i==0

kx=k*round(c); % wave number in x axis
ky=k*round(s); % wave number in y axis
end

kx=k*(c); % wave number in x axis
ky=k*(s); % wave number in y axis
%---------------------------------------------------------------------------
L33 = -ka1^2*A(5,5)*kx^2-2*ka1^2*A(4,5)*kx*ky-ka1^2*A(4,4)*ky^2+omega.^2.*I0;
L34 = i*ka1*(ka1*A(5,5)*kx+ka1*A(4,5)*ky);
L35 = i*ka1*(ka1*A(4,5)*kx+ka1*A(4,4)*ky);
L44 = D(1,1)*kx^2+2*D(1,6)*kx*ky+D(6,6)*ky^2+ka1^2*A(5,5)-omega.^2.*I2;
L45 = D(1,6)*kx^2+(D(1,2)+D(6,6))*kx*ky+D(2,6)*ky^2+i*ka1^2*A(4,5);
L55 = D(6,6)*kx^2+2*D(2,6)*kx*ky+D(2,2)*ky^2+ka1^2*A(5,5)-omega.^2.*I2;
%--------------------------------------------------------------------------
%Antisymmetric waves matrix:

M = [L33 L34 L35;
L34 L44 L45;
L35 L45 L55];


M=vpa(M);

%-------------------------------------------------------------------------
%Solve the determenent of the matrix and derive the roots

det_M=vpa(det(M));

Sol= solve(det_M,k);

k_A0=sym(Sol(1,1));

omega=2*pi*f;

digits(5);

k_A0=sym((subs(k_A0,omega)));

for p=1:length(f)

Cp_A0((phi_i+1),p)=omega(p)/real(k_A0(p));
end
%--------------------------------------------------------------------------
% Calcualtion of Group velocity values using and analytical differention of
% omega with respect to wavelength

syms omega;

diff_w=diff(Sol(1,1),omega);

omega=2*pi*f;

digits(5);

Cg_A0=subs(diff_w,omega);

end
% --------------------------------------------------------------------------
for m=1:length(f)

Cg_A0_1(:,m)=1/Cg_A0(m);

end

Cg_A0=Cg_A0_1;

end

%Group velocity calculation of Anti-symmetric waves.

Cg2_A0=((Cp_A0(2,:)-Cp_A0(1,:))/(1/360*2*pi));
Cgx_A0=(Cg_A0*cos(phi))-(Cg2_A0.*sin(phi));
Cgy_A0=(Cg_A0*sin(phi))+(Cg2_A0.*cos(phi));
C_55=3.0;
Cgx_A0=subs(Cgx_A0,C_55);
Cgy_A0=subs(Cgy_A0,C_55);
Cg_A0_0=sqrt(Cgx_A0.^2+Cgy_A0.^2);
save Cg_A0_0.mat Cg_A0_0;

我感觉程序没什么问题,但是就是总是超出内存,请高手指点一下,万分感谢!

2007-09-03 16:52
快速回复:[求助]解矩阵时总是out of memory
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033878 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved