MATLAB Answers


How to get the u, ux and uy while solving a parabolic PDE?

Asked by Bowen
on 23 Nov 2012

Hello all,

I'm trying to solve a parabolic PDE, which the coefficients may depend on location, time and its partial derivatives.

According to the standard parabolic form in Matlab, the coefficients c, a, f and d need to be prepared. From the Matlab document, the coefficients can be written in the "string form" with their dependences:

c = 'pde_coeff_c(x,y,t)';

a = 'pde_coeff_a(x,y,t)';

f = 'pde_coeff_f(x,y,t,u,ux,uy)';

d = 1;

with all the corresponding functions.

Boundary condition and geometry are exported from PDE toolbox GUI as myBoundaryMatrix and myGeomMatrix. Therefore, the mesh is generated as:

[p,e,t] = initmesh(myGeomMatrix, 'hmax', 0.03);

Initial condition u0 is initialised as:

u0 = 0;

and time sequence as:

tlist = 0:0.1:1;

Finally, call the parabolic solver:

u = parabolic(u0,tlist,myBoundaryMatrix,p,e,t,c,a,f,d);

With these configurations, I can successfully use the x, y and t variables to organise my coefficients like c and a. However, I cannot use the u, ux or uy while constructing coefficient f. The u, ux and uy are always empty matrices.

I believe the parabolic coefficients should be able to use u, ux and uy, as mentioned in

In all cases, the coefficients d, c, a, and f can be functions of position (x and y) and the subdomain index. For all cases except eigenvalue, the coefficients can also depend on the solution u and its gradient. And for parabolic and hyperbolic equations, the coefficients can also depend on time.

Thank you.

Best Regards,




No products are associated with this question.

1 Answer

Answer by Bill Greene
on 24 Nov 2012
 Accepted answer


Are you by any chance using a version of MATLAB older than R2012b? The capability to have coefficients in parabolic (and hyperbolic) analyses that depend on u, ux, and uy is new in that version of the product.


  1 Comment

Yes, you're right. The problem solved in 2012b. Thank you very much.


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!