Attempt to execute SCRIPT pdepe as a function:

Hi dears
I have problem with executing this program. Can anyone explain me what is going on here? /
Attempt to execute SCRIPT pdepe as a function: /Applications/MATLAB_R2019b.app/toolbox/matlab/funfun/pdepe.m Error in kpz (line 7) sol = pdepe(m,@heat1D,@heatIC,@heatBC,x,t);
opts = odeset('RelTol',1e-8,'AbsTol',1e-8);
N=200; xi=0; xf=5; ti=0; tf=5; TIME=tf-ti;
x = linspace(xi,xf,N);
t = linspace(ti,tf,200);
m = 0;
tic
sol = pdepe(m,@heat1D,@heatIC,@heatBC,x,t);
toc
w = sol(:,:,1);
surf(x,t,w)
xlabel('x')
ylabel('t')
zlabel('w(x,t)')
view([40 55])
%plot(w(200,:))
function [c,f,s] = heat1D(x,t,w,dwdx)
D=4; %0.2;
c = 1;
f = D*dwdx;
s = 1.5*dwdx.^2; %% NO NOISE
%s = 1*dwdx.^2 - 0.5/t; %%White
%s = 0.5*dwdx.^2 - 1/(x*sqrt(t)); %%Pink
%s = -0.5*dwdx.^2 - 0.5/(x*x); %%Brown
%s = 10.5*dwdx.^2 - 0.1*exp(-x*x/t)/t; %%Gauss
end
function w0 = heatIC(x)
w0=2;
end
function [pl,ql,pr,qr] = heatBC(xl,wl,xr,wr,t)
pl = wl;
ql = 0;
pr = 0;
qr = 1;
end

2 commentaires

which pdepe -all % what do you get ?
You have a script named "pdepe.m" probably rename or remove it.
I will try everything one more time. thanks for your support.

Connectez-vous pour commenter.

 Réponse acceptée

Your code runs as is for me. Perhaps you have overwritten the pdepe function? Try clearing it by typing
clear pdepe
Run the code again. If you still get the error, try typing
which pdepe
The result should be something like this
C:\Program Files\MATLAB\R2020a\toolbox\matlab\funfun\pdepe.m

14 commentaires

Also, what is the name of the script you are writing this code in? You haven't named it pdepe by any chance, have you?
I have still this problem
Attempt to execute SCRIPT pdepe as a function:
/Applications/MATLAB_R2019b.app/toolbox/matlab/funfun/pdepe.m
Error in pdepe (line 7)
sol = pdepe(m,@heat1D,@heatIC,@heatBC,x,t);
yeah I have named it as pdepe. Should I change this name to other name?
madhan ravi
madhan ravi le 21 Mar 2020
Modifié(e) : madhan ravi le 21 Mar 2020
Do you see the comment I made above?
Yes, you should rename your file to something other than pdepe
Oh, really I tried all you said but not working, still the same result.
How is it working on your Matlab "Cris LaPierre ". Can you give a little detailed information how to put this code on my matlab and use it.
Thanks a lot in advance.
Cris LaPierre
Cris LaPierre le 21 Mar 2020
Modifié(e) : Cris LaPierre le 21 Mar 2020
After renaming your script, be sure to delete the old file. Save As will not remove the original.
I am trying all my best but I have still this massage. If it is working properly on your Matlab why it is not working on mine. Should I try any other way? Please I need bif support.
try
which pdepe -all
Also, try restarting MATLAB.
Thanks for everyting but I don`t know what is going on with my Matlab. Still the same...
I restarted my lap top and software, did everything but not result.
What do you mean "did everything but not result"? Are you no longer getting the error message?
I got error on my Matlab still, then I tried this code to other laptop and it is working now. i guess there is a problem with my laptop.
What do you suggest to solve this problem on my laptop?
For now i will use other loptop to find solution to my equation.
Thanks dear a lot for your support.
Cris LaPierre
Cris LaPierre le 21 Mar 2020
Modifié(e) : Cris LaPierre le 21 Mar 2020
This error suggests that MATLAB is finding multiple files called pdepe.m. Let's see what files MATLAB is seeing. What is the result of
which pdepe -all

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by