MATLAB Tutorial Video 05 : Solving Differential Equations Numerically in MATLAB

preview_player
Показать описание
This is video 05 of the MATLAB TUTORIAL IN 1 HOUR programming playlist.

Use this link to download the ZIP file that has all the MATLAB files and other resources for this free 1 HOUR MATLAB video series.

Keywords:
Matlab programming, Numerical integration of differential equations in Matlab, Differential equations, First order linear differential equation, Numerical integration, Euler’s method of numerical integration, Modeling a bionic eye in Matlab, First order eye response in Matlab, Matlab for biotechnology, Matlab for life sciences, Matlab free video course, Matlab free tutorial, Matlab for life scientists, Matlab for bioresearch

In this video we are attacking a slightly more difficult problem. We are going to numerically solve a differential equation in Matlab. If you are a bit rusty on your differential equations, don’t worry, I will give you step by step explanations.

We are again taking a practical example from biotechnology. Say you are a researcher working on an artificial eye. Say you want to match the response of your bionic eye as close as possible to the human eye.

The human eye does not respond to a light stimulus instantaneously. It takes a while for the eye response to catch up. We find that the eye response model can be described by a first order linear differential equation. What we are saying is that the time derivative of the eye response is equal to some constant multiplied by the eye response plus another constant multiplied by the input stimulus.

By the way, many of the physical and biological phenomena are modeled as differential equations. Note that the solution of a differential equation is another equation and not a set of values. The above equation is a well known differential equation that has a known analytical solution.

Not all differential equations have such neatly wrapped up analytical solutions. Sometimes, we have to solve differential equations numerically.

Given the input u(t) at time zero and the output x(t) at time zero, we calculate the response of the system x(t) at time instant t1, where t1 comes slightly after t0, the starting time instant.

Now that we know the value of x(t) for t= t1, we seed the values of x(t1) and u(t1) and numerically calculate the value of x(t2) which is of course the x value at t2 seconds.

You get the drift I guess at this point. We seed the current values of x(t0) and u(t0) and find the value of x(t1) for the next time step. We keep repeating this for however many time steps we need the numerical solution for.

Now, there are several methods of numerically calculating the value of x(t) for the next time step, given we have the seed values for the current value of x and u.

One such method is the Euler’s method. This is the easiest method to understand and implement. It has its limitations when it comes to advanced problems. But we will stick to Euler’s method in this video. If you are interested in advanced methods like Runge-Kutta and Adam-Bashforth, drop me a comment please.

So this is how you numerically solve a differential equation in Matlab.

If you found this video useful, please like and subscribe. This will support the channel. Also I welcome your comments and feedback. Thanks for watching.

MATLAB is a registered trademark of The MathWorks.
Рекомендации по теме