Matlab 2D hyperbolic partial differential equation change to 1D

3 vues (au cours des 30 derniers jours)
Amit Kumar
Amit Kumar le 14 Mai 2014
Modifié(e) : Amit Kumar le 14 Mai 2014
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!

Réponses (0)

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by