马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
主函数
nr=8;
ns=5;
c=340;
f=200;
Lx=1.0;
Ly=1.5;
pa=[-1.307;
-2.141;
-2.141;
-.284;
.256e-2;
-11.552;
-.150e-5;
-.266e-1;
-.292e-7;
-3.357;
-.934e-10;
.184;
.671e-13;
-2.404;
.318e-13;
.146;
-.160e-14;
-3.476;
-1.133;
-2.195;
3.806;
.730;
.382;
11.502;
.655e-2;
-4.081;
.119e-2;
6.886;
.110e-3;
-.815]; %pa为实部系数
pa1=[-1.117;
0.542;
0.542;
-7.569;
-.364e-3;
-1.984;
-.131e-5;
.448e-1;
.689e-8;
-.622;
-721e-10;
.696e-1;
.239e-13;
-.494;
.415e-14;
.338e-1;
-.111e-15;
-.707;
-2.785;
2.668;
-10.015;
10.489;
.428e-1;
2.206;
.225e-3;
-1.216;
.252e-3;
1.504;
.171e-4;
-.354;] %pa1为虚部系数
x=0:50;
y=-10:10;
[xx,yy]=meshgrid(x,y);
zz=press(xx,yy,pa,pa1,nr,ns,c,f,Lx,Ly);
[c,h]=contour('v6',xx,yy,zz);
clabel(c,h);
子函数
function press(xx,yy,pa,pa1,nr,ns,c,f,Lx,Ly);
k=2*pi*f/c;
z=zeros(size(x));
for r=0:nr
krx=r*pi/Lx;
kry=sqrt(k^2-krx^2);
arx=pa(2*r+1)*cos(krx*x+kry*y)+pa(2*r+2)*cos(krx*x-kry*y)+pa1(2*r+1)*sin(krx*x+kry*y)+pa1(2*r+2)*sin(krx*x-kry*y);%压力函数的实部
ary=pa1(2*r+1)*cos(krx*x+kry*y)+pa1(2*r+2)*cos(krx*x-kry*y)+pa(2*r+1)*sin(krx*x+kry*y)+pa(2*r+2)*sin(krx*x-kry*y);%压力函数的虚部
zr=sqrt(arx^2+ary^2);
z=z+zr;
end
for s=0:ns
ksy=s*pi/Ly;
ksx=sqrt(k^2-ksy^2);
asx=pa(2*nr+2+2*s+1)*cos(ksx*x+ksy*y)+pa(2*nr+2+2*s+2)*cos(-ksx*x+ksy*y)+pa1(2*nr+2+2*s+1)*sin(ksx*x+ksy*y)+pa1(2*nr+2+2*s+2)*sin(-ksx*x+ksy*y);%压力函数实部
asy=pa1(2*nr+2+2*s+1)*cos(ksx*x+ksy*y)+pa1(2*nr+2+2*s+2)*cos(-ksx*x+ksy*y)+pa(2*nr+2+2*s+1)*sin(ksx*x+ksy*y)+pa(2*nr+2+2*s+2)*sin(-ksx*x+ksy*y);%压力函数虚部
zs=sqrt(asx^2+asy^2);
z=z+zs;
end
帮忙看看哪错了?怎么改?老是运行错误,谢谢 |