필터 지우기
필터 지우기

calling a function pdepe

조회 수: 3 (최근 30일)
Matt
Matt 2014년 7월 29일
댓글: Geoff Hayes 2014년 7월 29일
i am using pdepe to solve a coupled PDE.
m = 0; x = linspace(0,1,20); t = linspace(0,2,5);
sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
u = sol(:,:,1);
% A surface plot is often a good way to study a solution.
surf(x,t,u)
title('Numerical solution computed with 20 mesh points.')
xlabel('Distance x')
ylabel('Time t')
% A solution profile can also be illuminating.
figure
plot(x,u(end,:))
title('Solution at t = 2')
xlabel('Distance x')
ylabel('u(x,2)')
The boundary and initial conditions are saved in another two separate files files as below
function u0 = pdex1ic(x)
u0 = sin(pi*x);
function [c,f,s] = pdex1pde(x,t,u,DuDx)
c = pi^2;
f = DuDx;
s = 0;
My question is I want to plot c,f,s. How can i call them in the mail finction. I try to call like [c] = pdex1pde(x,t,u,DuDx); in the main functon but it says me undefine DuDx.?
Any help appriciated.
Thanks
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2014년 7월 29일
Matt - I gather that you want to plot the result of pdex1pde but am not sure where you want to try and plot this. What is the main function? Please update your above code to indicate where you have put the line to try and plot the data. As well, please format the code by highlighting it and pressing the {}Code button.
I don't understand the purpose of pdex1pde since it ignores the first three inputs...

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 1-D Partial Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by