# How to solve and insert and plot differential equations ?

2 views (last 30 days)
Prekshana Patil on 29 Jul 2020
Edited: Adib on 29 Jul 2020
How to solve and insert and plot differential equations ?

Edited: Adib on 29 Jul 2020
There are different numerical methods to solve the differential equations , like RK method ( for initial value problem ) , FDM, FEM, ( for boundary value problem) and many others. Which method , you will use it depends on your system with which you are dealing.
For example, If you want to calculate potential distribution of a metal line under a direct current flow , you have a governing equation of electric problem and two boundary conditions for current input output. To solve the problem using finite difference mathod ( FDM ) . First you have to discretize the governing equation and boundary conditions ( FDM discretization, you will find in your numerical books) . Then you will have some algebric equations like p(i+1,j)+p(i-1,j) + p(i, j+1) + p(i, j-1) - 2p(i,j) = constant ( here, p= electric potential of a node (i,j) ) ,and solve these algebric equations using Ax=B , A is a coefficient matrix, x is variable matix and B is constant matrix. We need x. When you have x , you have already solved the governing equation.
Now, you can plot the x to show the potential distribution or for other properties, like electric flux or heat generation per unit volume you can post process the potential distribution and can plot them .
Thank you.

### Community Treasure Hunt

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

Start Hunting!