problem with integral2 function in my codes
显示 更早的评论
integral2 function does not work proberly in my case. How can I simplify the expression in int5=integral2(ht,0,(2*L2),0,L1,'RelTol',1e-12,'AbsTol',1e-14,'Method','iterated'); and make the code work? Any help is appreciated.
For details, my codes are:
format long
clear all
close all
clc
syms x
syms y
%syms t
q=0.2; %W/cm2
a=0.25; %cm
L1=0.5; %cm
L2=1.5; %cm
h=0.001; %W/cm2.K
k=0.011; %W/cm.K
T_ambient=23;
T_initial=T_ambient;
alpha=0.0005789;%k/ro*c
delt=0.0220; %delt stands for deltatime<=(delx^2)/2alfa
Ts=1;
T=0;
for i=1:10
lambda=(i*pi)/(2*L2);
int1=integral(@(x)(q*cos(lambda*x)),L2-a,L2+a);
int2=integral(@(x)((cos(lambda*x)).^2),L2-a,L2+a);
Cn=int1./int2;
A2B1=-Cn./(k*lambda);
p1=(k.*lambda.*cosh(lambda.*L1))+(h.*sinh(lambda.*L1));
p2=(h.*cosh(lambda.*L1))+(k.*lambda.*sinh(lambda.*L1));
B3=p1./p2;
T=T+(A2B1.*cos(lambda.*x)).*(sinh(lambda.*y)-B3.*cosh(lambda.*y));
end
theta=0+T_initial;
for t=1:Ts
for m=1:5
mu=(m*pi)/(2*L2);
for n=1:5
beta=-662.09*n+3755.8;
int3=integral(@(x)(cos(mu.*x).^2),0,2*L2);
int4=integral(@(y)(cos(beta.*y).^2),0,L1);
ht=matlabFunction(-T.*cos(mu.*x)*cos(beta.*y));
int5=integral2(ht,0,(2*L2),0,L1,'RelTol',1e-12,'AbsTol',1e-14,'Method','iterated');
Fmn=int5/(int3*int4);
theta=theta+(Fmn.*cos(mu.*x)*cos(beta.*y)*exp(-alpha*(mu.^2+beta.^2).*t));
end
end
figure
ezcontourf(theta+T,[0 3],[0 0.5]);
xlabel('x [cm]')
ylabel('y [cm]')
title('Temperature Distribution [C]')
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!