1
$\begingroup$

Let's take the heat equation. We have a time derivative and spatial derivative. How to discretize the spatial derivative using Chebyshev spectral method and convert it into DAEs? Like in the form of $ F(\dot{x}(t),x(t),t) $

$$ \frac{\partial u}{\partial t} = \frac{\partial^2u}{\partial x^2} $$

Assuming boundary conditions $u(0,t) = u(L,t) = 0$ and initial conditions $u(x,0) = \sin(x)$.

I tried to apply Chebyshev spectral method assuming $ \frac{\partial^2u}{\partial x^2} = 0 $ and the code to find u is given below.

N = 16; [D,x] = cheb(N); D2 = D^2;
D2N = D2(2:N,2:N);
f = sin(x(2:N));
u = D2N\f;
u = [0; u; 0];

Does this mean that the values we get in u are in the form of x(t)? or my whole approach is wrong? How do I use the solver ode15s from this?

$\endgroup$
3
  • 1
    $\begingroup$ Is the "cheb" that you're using a function from the chebfun toolbox? $\endgroup$ Commented Jan 23, 2022 at 20:10
  • $\begingroup$ You might want to read up on the Galerkin procedure. $\endgroup$ Commented Jan 24, 2022 at 1:12
  • $\begingroup$ It is from the Spectral Methods in MATLAB by Lloyd N. Trefethen but not sure if it is the same as the toolbox $\endgroup$
    – dazemood
    Commented Jan 24, 2022 at 8:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.