# How can I program the code for solving PDE equation using finite difference method?

28 views (last 30 days)

Show older comments

### Answers (1)

Rishabh Singh
on 9 Jan 2022

Hi,

In the line below,

u(i,k+1) = u(i,k)+ delta_t*(A0 +A1*cos(omega*t)+beta1*((u(i+1,k)-2*u(i,k) + u(i-1,k))/(delta_r)^2 + 1/r *(u(i+1,k)-u(i-1,k))/(2*delta_r)));

make sure to replace 't' with 'k'. Also the code which you have provided does not produce the error as mentioned by you. Also can you provide more information regarding the variable which you are trying to plot. Is it velocity vs time or something else?

##### 0 Comments

### See Also

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!