Difference between revisions of "Scilab/C4/ODE-Applications/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 11: Line 11:
 
|-
 
|-
 
| 00:02
 
| 00:02
| Welcome to the Spoken Tutorial on '''“Solving ODEs using Scilab ode Function”'''  
+
| Welcome to the Spoken Tutorial on '''Solving ODEs using Scilab ode Function'''  
  
 
|-
 
|-
Line 27: Line 27:
 
|-
 
|-
 
| 00:18
 
| 00:18
|Plot the solution  
+
|Plot the solution.
  
 
|-
 
|-
 
|00:21
 
|00:21
|The typical examples we will be
+
|The typical examples will be:
 
+
  
 
|-
 
|-
 
| 00:24
 
| 00:24
|Motion of '''simple pendulum'''
+
|* Motion of '''simple pendulum'''
  
 
|-
 
|-
 
| 00:26
 
| 00:26
|'''Van der Pol equation'''
+
|* '''Van der Pol equation'''
  
 
|-
 
|-
 
|00:28
 
|00:28
|and ''' Lorenz system'''
+
|* and ''' Lorenz system'''.
  
 
|-
 
|-
Line 56: Line 55:
 
|-
 
|-
 
| 00:36
 
| 00:36
|and '''Scilab 5.3.3''' version  
+
|and '''Scilab 5.3.3''' version.
  
 
|-
 
|-
 
|00:40
 
|00:40
|To practise this tutorial, a learner should have basic knowledge of '''Scilab'''  
+
|To practice this tutorial, a learner should have basic knowledge of '''Scilab'''  
 
+
  
 
|-
 
|-
Line 78: Line 76:
 
| 00:56
 
| 00:56
  
|The '''ode function''' is an '''ordinary differential equation solver.'''
+
|The '''ode''' function is an '''ordinary differential equation''' solver.
 
+
  
 
|-
 
|-
  
 
| 01:01
 
| 01:01
||The syntax is '''y equal to ode within paranthesis y zero, t zero, t and f'''  
+
||The syntax is '''y equal to ode''' within parenthesis '''y zero, t zero, t''' and '''f'''.
 
+
 
+
  
 
|-
 
|-
Line 92: Line 87:
 
|01:10
 
|01:10
  
|| Here '''y zero''' is the initial conditon of the '''ODEs'''
+
|| Here '''y zero''' is the initial condition of the '''ODEs''',
 
+
 
+
  
 
|-
 
|-
Line 100: Line 93:
 
|01:15
 
|01:15
  
| '''t zero''' is the '''initial time'''  
+
| '''t zero''' is the '''initial time''',
  
 
|-
 
|-
 
|01:17
 
|01:17
|'''t''' is the '''time range'''   
+
|'''t''' is the '''time range''',  
 
+
 
   
 
   
 
|-
 
|-
Line 111: Line 103:
 
|01:19
 
|01:19
  
|and '''f''' is the '''function'''  
+
|and '''f''' is the '''function'''.
  
 
|-
 
|-
Line 118: Line 110:
  
 
||Consider the motion of '''simple pendulum.'''  
 
||Consider the motion of '''simple pendulum.'''  
 
  
 
|-
 
|-
 
|01:25
 
|01:25
 
|Let '''theta t''' be the angle made by the '''pendulum''' with the '''vertical''' at time '''t.'''
 
|Let '''theta t''' be the angle made by the '''pendulum''' with the '''vertical''' at time '''t.'''
 
  
 
|-
 
|-
  
 
| 01:33
 
| 01:33
|We are given the initial conditions  
+
|We are given the initial conditions-
  
 
|-
 
|-
Line 146: Line 136:
 
|01:44
 
|01:44
  
| Then the position of the '''pendulum''' is given  by  
+
| Then the position of the '''pendulum''' is given  by:
 
|-
 
|-
  
Line 152: Line 142:
  
 
|| '''theta double dash t minus g by l into sin of theta t equal to zero.'''  
 
|| '''theta double dash t minus g by l into sin of theta t equal to zero.'''  
 
  
 
|-
 
|-
 
| 01:56
 
| 01:56
 
| Here '''g equal to 9.8 m per second square''' is the '''acceleration due to gravity''' and  
 
| Here '''g equal to 9.8 m per second square''' is the '''acceleration due to gravity''' and  
 
  
 
|-
 
|-
Line 170: Line 158:
 
| 02:22
 
| 02:22
 
|We also have to '''plot''' the solution.  
 
|We also have to '''plot''' the solution.  
 
  
 
|-
 
|-
 
| 02:25
 
| 02:25
 
|Let us look at the code for solving this problem.  
 
|Let us look at the code for solving this problem.  
 
 
  
 
|-
 
|-
 
| 02:29
 
| 02:29
 
|Open '''pendulum dot sci''' on '''Scilab editor.'''  
 
|Open '''pendulum dot sci''' on '''Scilab editor.'''  
 
  
 
|-
 
|-
Line 194: Line 178:
 
|02:46
 
|02:46
 
| Next, we convert the given equation to a system of '''first order ODEs.'''  
 
| Next, we convert the given equation to a system of '''first order ODEs.'''  
 
  
 
|-
 
|-
Line 201: Line 184:
  
 
|We substitute the values of '''g''' and '''l''' .
 
|We substitute the values of '''g''' and '''l''' .
 
  
 
|-
 
|-
Line 207: Line 189:
 
| 02:56
 
| 02:56
 
||Here we take '''y''' to be the given '''variable theta''' and '''y dash''' to be '''theta dash.'''  
 
||Here we take '''y''' to be the given '''variable theta''' and '''y dash''' to be '''theta dash.'''  
 
 
  
 
|-
 
|-
Line 215: Line 195:
  
 
|Then we call the '''ode function''' with '''arguments y zero, t zero, t''' and the '''function Pendulum.'''  
 
|Then we call the '''ode function''' with '''arguments y zero, t zero, t''' and the '''function Pendulum.'''  
 
  
 
|-
 
|-
Line 227: Line 206:
  
 
| The first '''row''' will contain the values of '''y''' in the given '''time range.'''
 
| The first '''row''' will contain the values of '''y''' in the given '''time range.'''
 
  
 
|-
 
|-
Line 240: Line 218:
  
 
|Hence we plot both the '''rows''' with respect to '''time. '''
 
|Hence we plot both the '''rows''' with respect to '''time. '''
 
  
 
|-
 
|-
Line 246: Line 223:
 
|03:31
 
|03:31
  
|Save and execute the file '''Pendulum dot sci'''
+
|Save and execute the file '''Pendulum dot sci'''.
 
+
  
 
|-
 
|-
Line 254: Line 230:
  
 
|The plot shows how the values of '''y''' and '''y dash''' vary with '''time. '''
 
|The plot shows how the values of '''y''' and '''y dash''' vary with '''time. '''
 
 
 
  
 
|-
 
|-
Line 262: Line 235:
 
| 03:44
 
| 03:44
  
|Switch to '''Scilab console'''
+
|Switch to '''Scilab console'''.
 
+
  
 
|-
 
|-
Line 281: Line 253:
  
 
|Let us solve '''Van der Pol equation''' using the '''ode function.'''  
 
|Let us solve '''Van der Pol equation''' using the '''ode function.'''  
 
  
 
|-
 
|-
Line 287: Line 258:
 
| 04:03
 
| 04:03
  
|We are given the '''equation '''
+
|We are given the '''equation '''-
  
 
|-
 
|-
Line 300: Line 271:
  
 
|The initial '''conditions''' are '''v of two equal to one''' and '''v dash of two equal to zero. '''
 
|The initial '''conditions''' are '''v of two equal to one''' and '''v dash of two equal to zero. '''
 
  
 
|-
 
|-
Line 307: Line 277:
  
 
|Assume '''epsilon is equal to zero point eight nine seven. '''
 
|Assume '''epsilon is equal to zero point eight nine seven. '''
 
  
 
|-
 
|-
Line 313: Line 282:
 
|04:32
 
|04:32
  
|We have to find the solution within the '''time range two less than t less than ten and then plot'''  the solution.  
+
|We have to find the solution within the '''time range two less than t less than ten''' and then '''plot'''  the solution.  
 
+
 
+
  
 
|-
 
|-
Line 322: Line 289:
  
 
|Let us look at the code for '''Van der Pol equation. '''
 
|Let us look at the code for '''Van der Pol equation. '''
 
 
 
  
 
|-
 
|-
Line 343: Line 307:
  
 
|Since the '''inital time value''' is given as '''two''', we start the time range at two.  
 
|Since the '''inital time value''' is given as '''two''', we start the time range at two.  
 
  
 
|-
 
|-
Line 358: Line 321:
  
 
|Here '''y''' refers to the '''voltage v.'''  
 
|Here '''y''' refers to the '''voltage v.'''  
 
  
 
|-
 
|-
Line 377: Line 339:
  
 
| Save and execute the file '''vander pol dot sci.'''  
 
| Save and execute the file '''vander pol dot sci.'''  
 
 
  
 
|-
 
|-
Line 396: Line 356:
 
| 05:50
 
| 05:50
  
|The '''Lorenz system of equations''' is given by   
+
|The '''Lorenz system of equations''' is given by:  
  
 
|-
 
|-
Line 402: Line 362:
 
| 05:53
 
| 05:53
  
|'''x one dash equal to sigma into x two minus x one, '''
+
|'''x one dash equal to sigma into x two minus x one''',
 
+
  
 
|-
 
|-
Line 409: Line 368:
 
| 06:00
 
| 06:00
  
|'''x two dash equal to one plus r minus x three into x one minus x two and '''
+
|'''x two dash equal to one plus r minus x three into x one minus x two''' and
  
 
|-
 
|-
Line 416: Line 375:
  
 
|'''x three dash equal to x one into x two minus b into x three.'''  
 
|'''x three dash equal to x one into x two minus b into x three.'''  
 
  
 
|-
 
|-
Line 434: Line 392:
 
| 06:37
 
| 06:37
  
|Switch to '''Scilab editor''' and open '''Lorenz dot sci'''
+
|Switch to '''Scilab editor''' and open '''Lorenz dot sci'''.
 
+
  
 
|-
 
|-
Line 447: Line 404:
  
 
|Since there are three different '''ODEs,''' there are three initial conditions.  
 
|Since there are three different '''ODEs,''' there are three initial conditions.  
 
  
 
|-
 
|-
Line 454: Line 410:
  
 
|Then we define the '''inital time''' condition and next the '''time range.'''
 
|Then we define the '''inital time''' condition and next the '''time range.'''
 
  
 
|-
 
|-
Line 461: Line 416:
  
 
|We define the '''function Lorenz''' and then define the given constants '''sigma, r and b.'''
 
|We define the '''function Lorenz''' and then define the given constants '''sigma, r and b.'''
 
  
 
|-
 
|-
Line 467: Line 421:
 
| 07:08
 
| 07:08
  
|Then we define the '''first order ODEs. '''
+
|Then we define the '''first order ODEs.'''
  
 
|-
 
|-
Line 485: Line 439:
 
| 07:21
 
| 07:21
  
|Then we '''plot x one, x two''' and '''x three versus time. '''
+
|Then we '''plot x one, x two''' and '''x three versus time.'''
  
 
|-
 
|-
Line 498: Line 452:
  
 
|The '''plot''' of '''x one, x two''' and '''x three versus time''' is shown.  
 
|The '''plot''' of '''x one, x two''' and '''x three versus time''' is shown.  
 
  
 
|-
 
|-
Line 505: Line 458:
  
 
|Let us summarize this tutorial.  
 
|Let us summarize this tutorial.  
 
  
 
|-
 
|-
Line 511: Line 463:
 
| 07:41
 
| 07:41
  
|In this tutorial we have learnt to develop '''Scilab code''' to solve an '''ODE''' using '''Scilab ode function.'''  
+
|In this tutorial we have learnt to develop '''Scilab code''' to solve an '''ODE''' using '''Scilab ode function'''.
  
 
|-
 
|-
Line 518: Line 470:
  
 
|Then we have learnt to '''plot''' the solution.  
 
|Then we have learnt to '''plot''' the solution.  
 
 
  
 
|-
 
|-
 
|07:53
 
|07:53
| Watch the video available at the  link shown below
+
| Watch the video available at the  link shown below.
  
 
|-
 
|-
Line 529: Line 479:
 
| 07:56
 
| 07:56
  
| It summarises the Spoken Tutorial project  
+
| It summarizes the Spoken Tutorial project.
 
+
 
+
  
 
|-
 
|-
Line 537: Line 485:
 
|07:59
 
|07:59
  
||If you do not have good bandwidth, you can download and watch it  
+
||If you do not have good bandwidth, you can download and watch it.
  
 
|-
 
|-
Line 543: Line 491:
 
|08:04
 
|08:04
  
||The spoken tutorial project Team
+
||The spoken tutorial project Team:
  
 
|-
 
|-
Line 549: Line 497:
 
|08:06
 
|08:06
  
||Conducts workshops using spoken tutorials  
+
||Conducts workshops using spoken tutorials.
 
+
  
 
|-
 
|-
Line 556: Line 503:
 
|08:09
 
|08:09
  
||Gives certificates to those who pass an online test  
+
||Gives certificates to those who pass an online test.
 
+
  
 
|-
 
|-
Line 563: Line 509:
 
|08:13
 
|08:13
  
||For more details, please write to contact@spoken-tutorial.org  
+
||For more details, please write to contact@spoken-tutorial.org.
 
+
  
 
|-
 
|-
Line 570: Line 515:
 
|08:20
 
|08:20
  
|Spoken Tutorial Project is a part of the Talk to a Teacher project  
+
|Spoken Tutorial Project is a part of the Talk to a Teacher project.
 
+
 
+
  
 
|-
 
|-
Line 583: Line 526:
 
| 08:31
 
| 08:31
  
|More information on this mission is available at the link shown below
+
|More information on this mission is available at the link shown below.
  
 
|-
 
|-
Line 589: Line 532:
 
| 08:36
 
| 08:36
  
|This is Ashwini Patil signing off.
+
|This is Ashwini Patil, signing off.
  
 
|-
 
|-

Revision as of 10:15, 3 March 2015

Time Narration
00:01 Dear Friends,
00:02 Welcome to the Spoken Tutorial on Solving ODEs using Scilab ode Function
00:09 At the end of this tutorial, you will learn how to:
00:12 Use Scilab ode function
00:15 Solve typical examples of ODEs and
00:18 Plot the solution.
00:21 The typical examples will be:
00:24 * Motion of simple pendulum
00:26 * Van der Pol equation
00:28 * and Lorenz system.
00:30 To record this tutorial, I am using
00:33 Ubuntu 12.04 as the operating system
00:36 and Scilab 5.3.3 version.
00:40 To practice this tutorial, a learner should have basic knowledge of Scilab
00:45 and should know how to solve ODEs.
00:48 To learn Scilab, please refer to the relevant tutorials available on the Spoken Tutorial website.
00:56 The ode function is an ordinary differential equation solver.
01:01 The syntax is y equal to ode within parenthesis y zero, t zero, t and f.
01:10 Here y zero is the initial condition of the ODEs,
01:15 t zero is the initial time,
01:17 t is the time range,
01:19 and f is the function.
01:22 Consider the motion of simple pendulum.
01:25 Let theta t be the angle made by the pendulum with the vertical at time t.
01:33 We are given the initial conditions-
01:36 theta zero is equal to pi by four and
01:39 theta dash of zero is equal to zero.
01:44 Then the position of the pendulum is given by:
01:47 theta double dash t minus g by l into sin of theta t equal to zero.
01:56 Here g equal to 9.8 m per second square is the acceleration due to gravity and
02:03 l equal to zero point five meter is the length of the pendulum.
02:11 For the given initial conditions, we have to solve the ODE within the time range zero less than equal to t less than equal to five.
02:22 We also have to plot the solution.
02:25 Let us look at the code for solving this problem.
02:29 Open pendulum dot sci on Scilab editor.
02:34 The first line of the code defines the initial conditions of the ODE.
02:40 Then we define the intial time value. And we provide the time range.
02:46 Next, we convert the given equation to a system of first order ODEs.
02:52 We substitute the values of g and l .
02:56 Here we take y to be the given variable theta and y dash to be theta dash.
03:03 Then we call the ode function with arguments y zero, t zero, t and the function Pendulum.
03:12 The solution to the equation will be a matrix with two rows.
03:17 The first row will contain the values of y in the given time range.
03:21 The second row will contain the values of y dash within the time range.
03:27 Hence we plot both the rows with respect to time.
03:31 Save and execute the file Pendulum dot sci.
03:37 The plot shows how the values of y and y dash vary with time.
03:44 Switch to Scilab console.
03:47 If you want to see the values of y, type y on the console and press Enter.
03:54 The values of y and y dash are displayed.
03:58 Let us solve Van der Pol equation using the ode function.
04:03 We are given the equation -
04:06 v double dash of t plus epsilon into v of t square minus one into v dash of t plus v of t equal to zero.
04:20 The initial conditions are v of two equal to one and v dash of two equal to zero.
04:28 Assume epsilon is equal to zero point eight nine seven.
04:32 We have to find the solution within the time range two less than t less than ten and then plot the solution.
04:42 Let us look at the code for Van der Pol equation.
04:47 Switch to Scilab editor and open vander pol dot sci.
04:53 We define the initial conditions of the ODEs and time and then define the time range.
05:01 Since the inital time value is given as two, we start the time range at two.
05:07 Then we define the function vander pol and construct a system of first order ODEs.
05:15 We substitute the value of epsilon with zero point eight nine seven.
05:21 Here y refers to the voltage v.
05:25 Then we call ode function and solve the system of equations.
05:30 Finally we plot y and y dash versus t.
05:35 Save and execute the file vander pol dot sci.
05:41 The plot showing voltage versus time is shown.
05:45 Let's move onto Lorenz system of equations.
05:50 The Lorenz system of equations is given by:
05:53 x one dash equal to sigma into x two minus x one,
06:00 x two dash equal to one plus r minus x three into x one minus x two and
06:08 x three dash equal to x one into x two minus b into x three.
06:16 The initial conditions are x one zero equal to minus ten, x two zero equal to ten and x three zero equal to twenty five.
06:29 Let sigma be equal to ten, r be equal to twenty eight and b equal to eight by three.
06:37 Switch to Scilab editor and open Lorenz dot sci.
06:44 We start by defining the initial conditions of the ODEs.
06:48 Since there are three different ODEs, there are three initial conditions.
06:54 Then we define the inital time condition and next the time range.
07:00 We define the function Lorenz and then define the given constants sigma, r and b.
07:08 Then we define the first order ODEs.
07:12 Then we call the ode function to solve the Lorenz system of equations.
07:18 We equate the solution to x.
07:21 Then we plot x one, x two and x three versus time.
07:28 Save and execute the file Lorenz dot sci.
07:33 The plot of x one, x two and x three versus time is shown.
07:39 Let us summarize this tutorial.
07:41 In this tutorial we have learnt to develop Scilab code to solve an ODE using Scilab ode function.
07:50 Then we have learnt to plot the solution.
07:53 Watch the video available at the link shown below.
07:56 It summarizes the Spoken Tutorial project.
07:59 If you do not have good bandwidth, you can download and watch it.
08:04 The spoken tutorial project Team:
08:06 Conducts workshops using spoken tutorials.
08:09 Gives certificates to those who pass an online test.
08:13 For more details, please write to contact@spoken-tutorial.org.
08:20 Spoken Tutorial Project is a part of the Talk to a Teacher project.
08:23 It is supported by the National Mission on Eduction through ICT, MHRD, Government of India.
08:31 More information on this mission is available at the link shown below.
08:36 This is Ashwini Patil, signing off.
08:38 Thank you for joining.

Contributors and Content Editors

Gaurav, PoojaMoolya, Sandhya.np14