How I can speed up this program with a symbolic calculator ??

5 次查看(过去 30 天)
how I can speed up this program with a symbolic calculator knowing that I am using an intel core i3 fourth generation
here is the code
clear all
clc %introduire des variable
h=1e-9;
L=10e-9;
C11=132e9;
e31=-4.1;
mu=0;
E11=5.841e-9;
E33=7.124e-9;
ro=7500;
B=(pi/h);
r1=49.5e-9;
r2=50.5e-9;
A=pi*((r2^2)-(r1^2));
I=pi*(((r2^4)/4)-((r1^4/4)));
fun1=@(x,r) e31.*(r.^2).*sin(x).*B.*sin(B.*r.*sin(x));
fun2=@(x,r) E11.*r.*(cos(B.*r.*sin(x))).^2;
fun3=@(x,r) E33.*(B^2).*r.*(sin(B.*r.*sin(x))).^2;
F31 = integral2(fun1,0,2*pi,49.5e-9,50.5e-9,'method','iterated');
X11 = integral2(fun2,0,2*pi,49.5e-9,50.5e-9,'method','iterated');
X33 = integral2(fun3,15,2*pi,49.5e-9,50.5e-9,'method','iterated');
%introduire la matrice A
syms w
p1=((ro*A*w^2)/(C11*I));
p2=((-(mu^2*ro*A*w^2)+(F31^2/X11))/(C11*I));
p3=((F31*X33)/(X11*C11*I)); p4=(F31/X11);
p5=(X33/X11); a=[0 1 0 0 0 0;0 0 1 0 0 0;0 0 0 1 0 0;...
(p1) 0 (p2) 0 (p3) 0;0 0 0 0 0 1;0 0 (p4) 0 (p5) 0];
H=eye(6);
a=vpa(a);
M=expm(a*L);
%condition aux limite simplement appuyé
l1=H(1,:);
l3=H(3,:);
l5=H(5,:);
m1=M(1,:);
m3=M(3,:);
m5=M(5,:);
%la matrice final
K=[l1;l3;l5;m1;m3;m5];
DA=vpa(det(K));
%fréquence fondamental
for n = 1:5 F = vpasolve(DA,w,[0.4 3],'Random',true)
end

回答(1 个)

Walter Roberson
Walter Roberson 2021-7-16
编辑:Walter Roberson 2021-7-16
Symbolic expm of a 6 x 6 matrix is going to take a quite long time. It requires equivalent computing power to finding the eigenvalues of the matrix, but eigenvalues of a 6 x 6 symbolic matrix takes tens of hours (and will probably end up having to be in terms of unresolvable roots of a degree 6 polynomial) .
Then you extract coefficients and put together a new matrix and take det() of that 6 x 6 matrix, which will not be fast but at least is doable in an hour or so.
This is basically not really feasible symoblically.
You will need to only go as far symbolically as a*L, after which use matlabFunction() to create the expression as an anonymous function in w, and make the rest into a series of computation steps in a function that will be invoked from an fzero() call (you need fzero to be able to provide the range constraint.)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by