
The exact solution to a partial differential equation
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I know that MATLAB Has a PDE solver, but I wonder if it is possible to obtain the exact solution. For example, consider the heat equation
u_t = k u{xx}_
Is it possible to solve it with a set of initial and boundary conditions to calculate the exact equation of u
u = f(x,t)
and
u(x=0) = f(t)
I don't need numeral solution or the graph but the general equations.
0 Commenti
Risposta accettata
Stephan
il 8 Ago 2018
Hi,
% define symbolic variables
syms u(t) k
% define equation
eqn = u == k* diff(u,2);
% Solution without initial conditions
sol = dsolve(eqn);
% Define first derivative from u(t) for initial conditions
Du = diff(u);
% Define initial conditions
conds = [u(0) == 1, Du(0) == 0];
% Get solution with initial conditions
sol_conds = dsolve(eqn, conds);
will give:
>> pretty(sol)
/ t \ / t \
C1 exp| - ------- | + C2 exp| ------- |
\ sqrt(k) / \ sqrt(k) /
>> pretty(sol_conds)
/ t \ / t \
exp| ------- | exp| - ------- |
\ sqrt(k) / \ sqrt(k) /
-------------- + ----------------
2 2
or if you use a live script it looks like this:

Best regards
Stephan
6 Commenti
Torsten
il 9 Lug 2025
Modificato: Torsten
il 9 Lug 2025
@Stephan 's answer doesn't help to answer the original question. The requested u is a function of x and t following the partial differential equation
du/dt = k * d^2u/dx^2
The code
% define symbolic variables
syms u(t) k
% define equation
eqn = u == k* diff(u,2);
% Solution without initial conditions
sol = dsolve(eqn);
assumes that u is a function of t alone and solves k*u''(t) = u(t) which is an ordinary differential equation.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Boundary Conditions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!