用MATLAB自帶卷積分函數(shù)計(jì)算彈性半空間在一三角脈沖荷載下自由表面的豎向位移,與文獻(xiàn)正確結(jié)果相差10的5次方倍,但自己編寫卷積分代碼,反而得到文獻(xiàn)結(jié)果。請(qǐng)大家?guī)臀铱聪聠栴}出在哪?謝謝!
另外,為何MATLAB自帶卷積分函數(shù)結(jié)果矩陣的維數(shù)會(huì)是被卷積兩矩陣維數(shù)之和減1?
1. 問題描述,如下圖1所示:
![請(qǐng)大家?guī)臀铱聪挛业腗ATLAB卷積分問題出在哪里?謝謝!]()
2. 格林函數(shù),如下圖2所示:
![請(qǐng)大家?guī)臀铱聪挛业腗ATLAB卷積分問題出在哪里?謝謝!-1]()
3. 參考文獻(xiàn)正確解,如下圖3所示:
![請(qǐng)大家?guī)臀铱聪挛业腗ATLAB卷積分問題出在哪里?謝謝!-2]()
4. 本人直接用自編卷積分MATLAB代碼算的出解(如下圖4)及相應(yīng)代碼:
![請(qǐng)大家?guī)臀铱聪挛业腗ATLAB卷積分問題出在哪里?謝謝!-3]()
clear;
clc;
%loading history
dt=0.01;
ti=0.0008;
te=12;
t=ti:dt:te;
pt=(10*t./1.5).*(t>=0 & t<=1.5)+(20-10*t./1.5).*(t>1.5 & t<=3)+0.*(t>3);
m=length(pt);
%load distribution in space
rp=0.1;
ri=0;
rc=0.1;
dr=0.001;
r=ri:dr:rc;
pr=1*(r<=rp)+0*(r>rp);
n=length(pr);
%load function with respect to t and r
p=pr.'*pt;
%green's function
G=1;
cs=1;
for i=1:1:m
for j=1:1:n
u(j,i)=heaviside(cs*t(i)-r(j))/(pi*G*sqrt(t(i)^2-(r(j)/cs)^2));
end
end
%convolution and response of displacement
for i=1:1:m
for j=1:1:n
v(j,i)=0;
for k=1:1:i
for g=1:1:j
v(j,i)=v(j,i)+p(g,k)*u(j-g+1,i-k+1)*dr*dt;
end;
end;
end;
end;
%plot the response history
plot(t,v(n, );
xlabel('t/s');
ylabel('v/m');
grid on;
title('response of point A or C');
5. 直接用MATLAB自帶卷積分算的出解(如下圖5)及相應(yīng)代碼:
![請(qǐng)大家?guī)臀铱聪挛业腗ATLAB卷積分問題出在哪里?謝謝!-4]()
clear;
clc;
%loading history
dt=0.01;
ti=0.0008;
te=12;
t=ti:dt:te;
pt=(10*t./1.5).*(t>=0 & t<=1.5)+(20-10*t./1.5).*(t>1.5 & t<=3)+0.*(t>3);
m=length(pt);
%load distribution in space
rp=0.1;
ri=0;
rc=0.1;
dr=0.001;
r=ri:dr:rc;
pr=1*(r<=rp)+0*(r>rp);
n=length(pr);
%load function with respect to t and r
p=pr.'*pt;
%green function
G=1;
cs=1;
for i=1:1:m
for j=1:1:n
u(j,i)=heaviside(cs*t(i)-r(j))/(pi*G*sqrt(t(i)^2-(r(j)/cs)^2));
end
end
%convolution and response of displacement
v=conv2(u,p);
%plot the response history
rr=r(n);
[tpu,rpu]=meshgrid(ti:dt:2*te-dt,ri:dr:2*rc);
[X,Y,Z]=meshgrid(linspace(min(tpu( ),max(tpu( )),linspace(min(rpu( ),max(rpu( )),linspace(min(v( ),max(v( )));
V=Y;
h=contourslice(X,Y,Z,V,tpu,rpu,v,[0 0]+rr);
set(h,'edgecolor','k');
contourslice(X,Y,Z,V,tpu,rpu,v,[0 0]+rr);
xlabel('t/s');
ylabel('r/m');
zlabel('v/m');
axis([0 12 0 0.1 0 12e4]);
view(0,0);
grid on;
title('displacement response history of point A or C'); |