3
$\begingroup$

I've an equation like this to solve with the crank-nicolson method

$$U_t -\frac{y}{2} U_x + \frac{x}{2}U_y = 0,$$

where $x$ and $y$ are: [-2,5:2,5] and the time $T$ is from $0$ to $2\pi$. Is there anyone who can help me? I have to solve it in a matlab code. thanks everyone. I'm sorry for my english.

$\endgroup$

1 Answer 1

3
$\begingroup$

Here is a tutorial on how to solve this equation in 1D with example code. The code is Python (which is similar to MATLAB so you should be able to translate). To extend this to 2D you just follow the same procedure for the other dimension and extend the matrix equation.

How to discretize the advection equation using the Crank-Nicolson method?

$\endgroup$
0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.