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?