how can I write c,f,s in pde function?

if c is changing with x then how to write f and s
function [c,f,s]= pdefun1(x,z,u,DuDx)
c = (2*U_a/D_s)*(1-x.^2/R1^2); %%% HERE c is changing with x
f = DuDx;
s=0;
end
%%
function u0 = pdeic1(x)
u0 =20;
end
%%
function [pl,ql,pr,qr] = pdebc1(xl,ul,xr,ur,z)
pl=0;
ql=1;
pr=0.6*u0;
qr=1;
end

5 comentarios

Torsten
Torsten el 20 de Dic. de 2018
Why should it affect f and s if c is changing with x ?
Shangeetha Mahendran
Shangeetha Mahendran el 20 de Dic. de 2018
Thank you for the reply.
I thought i have to give c in vector format, therefore, s,f should be in vector format.
Torsten
Torsten el 20 de Dic. de 2018
Editada: Torsten el 20 de Dic. de 2018
No, you have to return a scalar value for c, i.e. c evaluated at x,z,u and DuDx (where all of these input parameters are scalars in your case).
Thus you could also write
c = (2*U_a/D_s)*(1-(x/R1)^2);
Shangeetha Mahendran
Shangeetha Mahendran el 20 de Dic. de 2018
thank you
madhan ravi
madhan ravi el 20 de Dic. de 2018
Editada: madhan ravi el 20 de Dic. de 2018
@Torsten please post it as an answer so that it would be helpful for many on how to solve pdes properly.

Iniciar sesión para comentar.

Respuestas (0)

Productos

Versión

R2017b

Preguntada:

el 20 de Dic. de 2018

Editada:

el 20 de Dic. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by