24小时热门版块排行榜    

查看: 343  |  回复: 0

hawaiicn

新虫 (初入文坛)

[交流] 请大家帮我看下我的MATLAB卷积分问题出在哪里?谢谢!

用MATLAB自带卷积分函数计算弹性半空间在一三角脉冲荷载下自由表面的竖向位移,与文献正确结果相差10的5次方倍,但自己编写卷积分代码,反而得到文献结果。请大家帮我看下问题出在哪?谢谢!

另外,为何MATLAB自带卷积分函数结果矩阵的维数会是被卷积两矩阵维数之和减1?

1. 问题描述,如下图1所示:

请大家帮我看下我的MATLAB卷积分问题出在哪里?谢谢!

2. 格林函数,如下图2所示:

请大家帮我看下我的MATLAB卷积分问题出在哪里?谢谢!-1

3. 参考文献正确解,如下图3所示:

请大家帮我看下我的MATLAB卷积分问题出在哪里?谢谢!-2

4. 本人直接用自编卷积分MATLAB代码算的出解(如下图4)及相应代码:

请大家帮我看下我的MATLAB卷积分问题出在哪里?谢谢!-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)及相应代码:

请大家帮我看下我的MATLAB卷积分问题出在哪里?谢谢!-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');
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 hawaiicn 的主题更新
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见