该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
clear all;
%求贝塞尔函数零点
maxv = 2;
maxs =44;
MAXS =100;
j= zeros(maxv, MAXS);
incr =4;
for v=0:maxv-1
if (v==0)
j(v+1,1) = fzero(@(x)besselj(v,x),2);
else
j(v+1,1) = fzero(@(x)besselj(v,x),3.8);
end
for s=2:maxs
j(v+1,s) = fzero(@(x)besselj(v,x),j(v+1,s-1)+incr);
end
end
for p=maxs+1:MAXS
j(1,p)=j(1,maxs)+pi*(p-maxs);
j(2,p)=j(2,maxs)+pi*(p-maxs);
end
T0 = 22;
k=17;%导热系数w/cm*k
r=0;%求解位置
t=1;%求解时间
b=0.5;%材料半径cm
a=0.025;%激光光斑半径cm
A=11.9;%材料热扩散率
d=1 ;%吸收率
h=0.01;%材料厚度cm
%画网格
Q=0.01;%间隔
xx=-0.3:Q:0.3;
yy1=sqrt(0.09-xx.^2)+0.275;
yy2=-sqrt(0.09-xx.^2)+0.275;
size1 = int8(0.6/Q+1);
TT1= zeros(1,size1);
%存储不同功率下的温度差
PP=0.1:0.1:3;
ANSWER_P=zeros(1,30);
TT1_P = zeros(1,30);
TT2_P = zeros(1,30);
for P = 1:30%改变功率
I0=153*PP(P)%功率密度w/cm^2
for N=1:0.6/Q+1
r=sqrt(yy1(N)^2+xx(N)^2);
T=0;
for m=1:MAXS
B=j(2,m);
T=T+besselj(0,B*r)*besselj(1,B*a)*(1-exp(-A*B^2*t))/(B^3*besselj(0,B*b)^2);
if m==MAXS
TT1(1,N)=(T*2*a+a^2*A*t)*d*I0/(k*h*b^2);
end
end
end
TT2= zeros(1,size1);
for N=1:0.6/Q+1
r=sqrt(yy2(N)^2+xx(N)^2);
T=0;
for m=1:MAXS
B=j(2,m);
T=T+besselj(0,B*r)*besselj(1,B*a)*(1-exp(-A*B^2*t))/(B^3*besselj(0,B*b)^2);
if m==MAXS
TT2(1,N)=(T*2*a+a^2*A*t)*d*I0/(k*h*b^2);
end
end
end
h=plot(xx,TT1,'',xx,TT2,''); %绘图
hold on
xlabel('x/cm');
ylabel('T/℃');
title('边缘温度');
legend('cold','hot');
set(h,'LineSmoothing','on'); %设置曲线为光滑
TT1_P(P)=sum(TT1)/(0.6/Q+1);
TT2_P(P)=sum(TT2)/(0.6/Q+1);
ANSWER_P(P)=TT2_P(P)-TT1_P(P);
end
plot(PP,ANSWER_P)
%{
[xx,yy]=meshgrid(x,y);
zz=sqrt(xx.^2+yy.^2);
TT= zeros(1/Q+1,1/Q+1);
%家和
for M=1:1/Q+1
for N=1:1/Q+1
r=zz(M,N);
T=0;
for m=1:MAXS
B=j(2,m);
T=T+besselj(0,B*r)*besselj(1,B*a)*(1-exp(-A*B^2*t))/(B^3*besselj(0,B*b)^2);
if m==MAXS
TT(M,N)=(T*2*a+a^2*A*t)*d*I0/(k*h*b^2);
end
end
end
end
surf(xx,yy,TT)
%}
运行代码出现下边的错误:
未定义与 'matlab.graphics.chart.primitive.Line' 类型的输入参数相对应的运算符 '*'。
出错 Untitled12_3 (line 54)
TT1(1,N)=(T*2*a+a^2*A*t)*d*I0/(k*h*b^2);