Matlab 2D hyperbolic partial differential equation change to 1D
3 次查看(过去 30 天)
显示 更早的评论
I wish to change 2D hyperbolic PDE script to 1D PDE. I am a beginner in PDE to want to study the code and changes. Below is my code (Code is from matlab documentation). If I want to change to 1D, what part will change?
clear all;
clc;
close all;
[p,e,t]=initmesh('squareg');
x=p(1,:)';
y=p(2,:)';
u0=atan(cos(pi/2*x));
ut0=3*sin(pi*x).*exp(cos(pi*y));
n=31;
tlist=linspace(0,5,31);
uu=hyperbolic(u0,ut0,tlist,'squareb3',p,e,t,1,0,0,1);
figure; set(gcf,'renderer','zbuffer');
delta=-1:0.1:1;
[uxy,tn,a2,a3]=tri2grid(p,t,uu(:,1),delta,delta);
gp=[tn;a2;a3];
newplot;
umax=max(max(uu));
umin=min(min(uu));
for i=1:n
pdeplot(p,e,t,'xydata',uu(:,i),'zdata',uu(:,i),'zstyle','continuous',...
'mesh','off','xygrid','on','gridparam',gp,'colorbar','off');
axis([-1 1 -1 1 umin umax]); caxis([umin umax]);
M(i)=getframe;
end
movie(M,1);
By the way, is there any sample code to represent 1D hyperbolic PDE of string vibration? I searched a lot, but finally found it in malab documentation. Many codes implement finite difference method, but I want to use huperbolic function builtin matlab. So any references, suggestions, comments most welcome. Thanks in advance!
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 PDE Solvers 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!