Borrar filtros
Borrar filtros

calling a function pdepe

3 visualizaciones (últimos 30 días)
Matt
Matt el 29 de Jul. de 2014
Comentada: Geoff Hayes el 29 de Jul. de 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.
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 comentario
Geoff Hayes
Geoff Hayes el 29 de Jul. de 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...

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre 1-D Partial Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by