- #1

- 2

- 0

## Main Question or Discussion Point

I have big problem with finite difference schemes (DS) on Matlab. I need write DS on Matlab, example:

u_x=(u_(i+1,j)-u_(i-1,j))/2, we choose step is 1.

On Matlab:

u_x=(u( :,[2:n,n])-u( :,[1,1:n-1]))/2

And I can write u_y, u_xx, u_yy, u_xy. But now, I need to write for higher order, example, u_xxx, u_yyy, u_xxy, u_xyy, u_xxxx, u_yyyy, u_xxyy, u_xyyy, u_xxxy. From 3rd order, I cannot do it. Please help me. Many thanks.

P/s: I just need on Matlab code, I can write the schemes in mathematical form.

u_x=(u_(i+1,j)-u_(i-1,j))/2, we choose step is 1.

On Matlab:

u_x=(u( :,[2:n,n])-u( :,[1,1:n-1]))/2

And I can write u_y, u_xx, u_yy, u_xy. But now, I need to write for higher order, example, u_xxx, u_yyy, u_xxy, u_xyy, u_xxxx, u_yyyy, u_xxyy, u_xyyy, u_xxxy. From 3rd order, I cannot do it. Please help me. Many thanks.

P/s: I just need on Matlab code, I can write the schemes in mathematical form.

Last edited: