How can I program the code for solving PDE equation using finite difference method?
Mostrar comentarios más antiguos
Hi, I am trying to solve a PDE governing equation using finite differenc method and I am having trouble to set up the programming code for this equation together with the initial and boundary condition. I tried to do the programming code, but it always show 'Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-300'. The equation is dudt= A0+A1*cos(omega*t) +Beta1* [d2udr2+1/r(dudr)], initial condition is u(r,0) = 0, and boundary condition is u(1,t) = 0, t>0.
2 comentarios
Voss
el 27 de Dic. de 2021
Please show MATLAB code.
Nur Nadhirah Syed Malik
el 27 de Dic. de 2021
Respuestas (1)
Rishabh Singh
el 9 de En. de 2022
0 votos
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?
Categorías
Más información sobre Boundary Conditions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!