calling a function pdepe

1 view (last 30 days)
Matt on 29 Jul 2014
Commented: Geoff Hayes on 29 Jul 2014
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.
title('Numerical solution computed with 20 mesh points.')
xlabel('Distance x')
ylabel('Time t')
% A solution profile can also be illuminating.
title('Solution at t = 2')
xlabel('Distance x')
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.
  1 Comment
Geoff Hayes
Geoff Hayes on 29 Jul 2014
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...

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!