Matlab绘制频散曲线程序代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
function disper
%绘制平板频散曲线
%tic
clc;clear;
cl=5790;%材料纵波波速(钢板)
cs=3200;%材料横波波速(钢板)
dfd=0.01*1e3;
fd0=(0.01:dfd/1e3:20)*1e3;% 频厚积( MHz*mm ) d_Q235=6;
cps_min=2700;
cpa_min=100;
cp_max=10000;
mode=3;%绘制的模式数
precision=1e-8;
cpa=zeros(length(fd0),mode);
cps=zeros(length(fd0),mode);
for i=1:length(fd0)
fd=fd0(i);
[cp12 n]=ss(cps_min,cp_max,fd,cl,cs,mode);
for j=1:n
cp1=cp12(j,1);
cp2=cp12(j,2);
cps(i,j)=serfen(cp1,cp2,fd,cl,cs,precision); end
[cp12 n]=aa(cpa_min,cp_max,fd,cl,cs,mode);
for j=1:n
cp1=cp12(j,1);
cp2=cp12(j,2);
cpa(i,j)=aerfen(cp1,cp2,fd,cl,cs,precision);
end
end h=zeros(mode,2);
%相速度
figure(1)
for j=1:2
if j==1
cp=cps;
color='b';
else
cp=cpa;
color='r'; end
for i=1:mode cpp=cp(:,i);
ind=find(cpp==0); if ~isempty(ind)
h(i,j)=plot((fd0(ind(end)+1:end))/d_Q235,cpp(ind(end)+1:end),color);
else h(i,j)=plot(fd0/d_Q235,cpp,color);
end
hold on
end
if j==2
xlabel('f/(KHz)')
ylabel('C_{ p}/(km • s^-l})')
title('6mm 钢板相速度频散曲线')
set(gca,'xtick',(0:0.6:20)*1e3/d_Q235,'xticklabel',(0:0.6:20)*1e3/d_Q235)
xlim([0, 1000]);%
set(gca,'ylim',[0 cp_max],'ytick',(0:cp_max/1e3)*1e3,...
'yticklabel',0:cp_max/1e3)
grid on
hSGroup = hggrou p;%要在子对象构建之后构建,构建后立即使用,否则将失效
hAGroup = hggroup;
set(h(:,1),'parent',hSGroup)
set(h(:,2),'parent',hAGroup)
set(get(get(hSGroup,'Annotation'),'LegendInformation'),...
'IconDisplayStyle','on');
set(get(get(hAGroup,'Annotation'),'LegendInformation'),...
'IconDisplayStyle','on');
legend('对称模式','反对称模式')
end
end %群速度
figure(2)
for j=1:2
if j==1
cp=cps; color='b';
else
cp=cpa;
color='r';
end
for i=1:mode
cpp=cp(:,i);
ind=find(cpp==0);
if ~isempty(ind)
fd=fd0(ind(end)+1:end)'; cpp=cpp(ind(end)+1:end);
else
fd=fd0';
end
dcdf=diff(cpp)/dfd;
cg=c pp (1:e nd-1)A2./(cp p(1:e nd-1)-fd(1:e nd-1).*dcdf);
h(i,j)=plot(fd(1:end-1)/d_Q235,cg,color);
hold on
end
if j==2
xlabel('f/(KHz)')
ylabel('C_{g}/(km • s^-l})')
title('6mm 钢板群速度频散曲线')
set(gca,'xtick',(0:0.6:20)*1e3/d_Q235,'xticklabel',(0:0.6:20)*1e3/d_Q235)
xlim([0, 1000]);%
set(gca,'ylim',[0 5.5]*1e3,'ytick',(0:0.5:5.5)*1e3,'yticklabel',0:0.5:5.5)
grid on
hSGroup = hggrou p;%要在子对象构建之后构建,构建后立即使用,否则将失效
hAGroup = hggroup;
set(h(:,1),'parent',hSGroup)
set(h(:,2),'parent',hAGroup)