Doubt regarding pdepe in matlab
1 回表示 (過去 30 日間)
古いコメントを表示
Hii Friends,
Could you give me your suggestion regarding this problem.
I have the following equation where in the initial, boundary conditions and other parameters have been specified.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166016/image.jpeg)
I was able to solve in matlab using the following code
%---pdepe function-----% function [c,f,s] = gvdpde(t,z,u,DuDt) i = sqrt(-1); beta2 = -2.907e-25; T0 = 35e-12; %Ld = T0^2/abs(beta2); Ld = 4500; c = (2*i*Ld)./T0^2; f = DuDt; s = 0;
%---Initial condition----% function u0 = gvdic(t) T0 = 35e-12; u0 = exp(-0.5.*(t/T0).^2);
%-----Boundary condition-----% function [pl,ql,pr,qr] = gvdbc(tl,ul,tr,ur,z) pl = 0; ql = 1; pr = ur - 1; qr = 1;
%-----Main function-----% function gvd
clc; clear all; close all;
m = 0; T0 = 35e-12; t = linspace(-30*T0,30*T0,150); z = linspace(0,1000,100); z1 = linspace(0,4500,100); z2 = linspace(0,45000,100);
sol = pdepe(m,@gvdpde,@gvdic,@gvdbc,t,z); sol1 = pdepe(m,@gvdpde,@gvdic,@gvdbc,t,z1); sol2 = pdepe(m,@gvdpde,@gvdic,@gvdbc,t,z2); % Extract the first solution component as u. u = sol(:,:,1); u1 = sol1(:,:,1); u2 = sol2(:,:,1);
% A surface plot is often a good way to study a solution. surf(t,z,abs(u2)); title('Numerical solution computed with 20 mesh points.'); xlabel('Time t'); ylabel('Distance z'); % A solution profile can also be illuminating. figure; plot(t,abs(u(end,:)),t,abs(u1(end,:)),t,abs(u2(end,:)),'LineWidth',2); legend('z<<Ld','z=Ld','z>Ld'); xlabel('Time t'); ylabel('Intensity'); grid on % --------------------------------------------------------------
Now in the next step i need to add 3'rd order flux term as shown in the snap
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166017/image.jpeg)
Is it possible to solve it using the same pdepe function. Can anyone give me an hint to solve this.
Awaiting your kind replies.
pa1
5 件のコメント
Torsten
2017 年 7 月 14 日
Isn't it true that usually, the degree of the PDE in space determines the number of boundary conditions ? In this case, you had to supply three conditions.
Best wishes
Torsten.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Geometry and Mesh についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!