Table of Contents

Section 1: Introduction
MATLAB Essentials, Part 1

8m 36s

Intro
0:00
Purpose of MATLAB
0:17
Interactive Use
0:39
Accessing MATLAB
1:50
MATLAB Command Line
2:06
Navigating MATLAB Page
3:24
Limits
3:40
Predefined Value
4:10
Variables
4:48
Exponentials
6:59
Changing Defined Values
7:19
Whos Function
7:45
MATLAB Essentials, Part 2

7m 39s

Intro
0:00
General Functions
0:06
Date
0:09
Calendar
0:14
Commands
0:21
Command Versus Function
0:29
Scalars Versus Arrays
0:50
Plot Command
3:14
Ezplot
3:49
Help
4:30
Magic (22)
5:28
Plotting 3D Graph
6:54
Section 2: MATLAB Fundamentals
Introduction to Programs

6m 42s

Intro
0:00
Help Function
0:09
Command History
1:09
Navigating
1:14
Current Folder
1:20
Resize and Undocking Windows
1:31
Sample Program
1:49
Example: Interest Calculator
3:28
Interpreter Versus Compiler
5:10
Arrays & Matrices

7m 6s

Intro
0:00
What is a matrix?
0:12
What is vector?
0:23
Initializing Array
0:52
Checking Vector Size
1:38
Using Commas
1:56
Linspace
3:06
Subscript
4:40
Matrices
5:53
Using Semicolon
6:07
Transposing Matrix
6:44
Operator, Expression & Statements

13m 26s

Intro
0:00
Scratchpad
0:14
Expressions
0:54
Numbers
1:04
Eps
3:03
Realmin
3:24
Realmax
3:27
Data Types
3:37
Default Data Types
3:44
Double Precision
3:47
Precedence of Operators
4:19
What Are Arithmetic Operators?
4:49
Combining Operations
5:24
Precedence Rules
5:36
Parenthesis
5:53
Power, Multiplication and Division
6:12
Addition and Subtraction
6:18
Arithmetic Operation on Arrays
6:54
Expressions
8:21
Ans
9:09
Statements
9:19
Multiple Statements
11:50
Repeating With For

14m 21s

Intro
0:00
Repetition
0:19
Newton’s Method
1:39
Factorials
4:11
Limit of a Sequence
6:03
Basic For Construct
9:23
Example: Leaving Out For
12:26
Decisions, Part 1

14m 35s

Intro
0:00
If Function
0:13
Rand
0:44
Meaning of “1” and “0”
1:53
If-Else Construct
3:48
Elseif
8:43
Using Elseif
10:44
Logical Operators
12:13
&, |, ~
12:33
Decisions, Part 2

8m 53s

Intro
0:00
Multiple Ifs Versus Elseif
0:09
Nested Ifs
2:24
Example Nested If
2:52
Vectorizing Ifs
4:45
Switch
5:12
Last Notes on MATLAB Introduction

9m 47s

Intro
0:00
Complex Numbers
0:12
i
0:30
j
0:39
Square Root
1:19
Exponential
1:30
Z
1:38
Absolute Value
2:09
Angle
2:11
Circle
2:44
Axis
3:29
Complex Conjugate Transpose
5:24
Input/ Output
5:52
Input Statement
6:48
Help
9:19
Section 3: Logical Vectors
Logical Vectors, Part 1

11m 23s

Intro
0:00
Executing a Logical Operation
1:24
Vector
1:43
Discontinuous Graphs
2:50
Avoiding Division By Zero
5:03
Epsilon
6:35
Rolling Dice
7:49
Rand
8:09
Floor
8:24
Finding Percentage
9:46
Logical Vectors, Part 2

11m 40s

Intro
0:00
Logical Operators and Vectors
0:09
Logical Functions
1:09
Any
1:19
Exist
2:00
Find(x)
2:20
Defining a New Vector
3:31
Logical Vectors Instead of Elseif Ladders
4:35
Example: Tax
4:45
If ti
6:04
Elseif ti
6:25
Executing in MATLAB
7:51
Example: Using Logical Vector
8:21
Section 4: Program Design
Program Design & Algorithm Development

19m 36s

Intro
0:00
Problem Analysis
0:36
Problem Statement
0:57
Processing Scheme
1:06
Algorithm
1:16
Program Algorithm
1:52
Evaluation
2:12
Application
3:11
Example: Projectile
3:54
Example Executed in MATLAB
9:41
Txmax
11:19
Xmax
11:43
Computing Speed and Angle Direction of Projectile
13:27
Velocity
14:11
Computing Time and Horizontal Distance at Max. Altitude
15:05
Display Altitude
16:10
Num2str
16:55
Plot
17:22
Figure
18:25
Section 5: Graphics
Graphics, Part 1

9m 14s

Intro
0:00
Plot Statement
0:27
Straight Line Graphs
2:29
MATLAB Easy-to-Use Plotting Commands
3:38
Labels
4:17
Example: Label
4:36
Xlabel
6:33
Ylabel
6:51
Line Styles, Markers and Color
7:05
Zooming In
9:01
Graphics, Part 2

17m 20s

Intro
0:00
Multiple Plots on the Same Axis
0:07
Hold On
0:53
Plotyy
2:44
Plot (x) (y)
3:34
Subplots
4:39
Figure
9:15
Graphical Input
10:06
Logarithmic Plots
11:48
Polar Plots
12:57
Fplot
14:29
Graphics, Part 3

18m 37s

Intro
0:00
Comet3
2:37
Mesh Surfaces
3:02
Visualizing Vector Fields
5:29
Contour
6:49
Voltage Field and Gradients
10:03
Rotation of 3D Graphs
10:30
Rotation Angles
12:30
Polar Angle
13:26
Pause Command
14:37
Other Cool Graphics Functions
14:59
Area
15:14
Bar
16:20
Compass
16:48
Errorbar
17:17
Section 6: Loops
Loops

10m 38s

Intro
0:00
Powerful Force Statement and Determinate
0:11
Indeterminate Repetition
0:36
Binomial Coefficient
0:50
For Loop
2:40
Determinate Repetition Using For
3:40
Indeterminate Repetition Using While
3:49
A Guessing Game
4:12
Create Steps to Build a Program
6:06
Implement with Syntax in MATLAB
6:08
Fixing Code Error
8:44
Condition and Loop
10:00
While

17m 1s

Intro
0:00
Doubling Time of an Investment
0:33
Create Steps
0:57
Translate Into Code
2:22
Conditions and Loops
4:57
Determinate For Loop Unavailability
5:07
Prime Numbers
5:27
Create Steps
6:59
Compute in MATLAB
11:11
Break and Continue
12:05
Menu
13:37
Menu Window
15:27
Do This and Do That
15:33
Value of K
16:44
Section 7: Project
Projectile Problem

16m 33s

Intro
0:00
Projectile Problem
0:12
Air Resistance
3:27
Location of Projectile
4:58
Example in MATLAB
6:20
Air Friction (k)
6:28
Gravitational Force (g)
6:32
Dt
6:41
Solving Differential Equation
10:59
Determining If/When the Object Hits the Ground
11:59
xhit
12:51
Chart
15:39
Section 8: Function M-Files
Function M-Files, Part 1

12m 55s

Intro
0:00
Type
0:21
Type Sin
0:33
Type Fzero
0:55
M-file Versus Script File
1:10
Inline Objects
1:54
Input Argument
4:29
Function M-file
6:01
Defining Function
7:24
Function Y
8:14
Relative Error
9:36
Creating Finite Steps
9:58
Display
10:58
Function M-Files, Part 2

14m 14s

Intro
0:00
Calculating Mean and Average
0:27
Dummy Variables
2:59
Multiple Input/ Output Arguments
4:05
Function Names
4:35
Adding Comments
4:56
h-1 Line
5:31
Local Variables
5:57
Global Variables
6:52
Defining Global Variables
7:15
Persistent Variables
8:17
Clearing Persistent Variables
9:49
Subfunctions
12:12
P-code Files
13:03
Function M-Files, Part 3

11m 54s

Intro
0:00
Feval
2:00
Example: Rewriting Procedure as Newton Function
2:35
Defining Function
2:50
Overview: How to Use Function
5:43
Command/Function Duality
6:18
Example
6:59
Debugging a Script
7:22
Breakpoint Alley
8:02
Debugging a Function
10:09
Section 9: Graphics Continued
More on Graphics

11m 13s

Intro
0:00
Animation
0:07
Get Frame Function
0:33
Execute in MATLAB
1:30
Movie Function
1:44
Handle Graphics Facility
2:29
Example
2:32
P = Plot
4:35
Xor
5:02
Drawnow
5:35
Creating 3D Plot
7:28
Graphical User Interface, Part 1

7m 25s

Intro
0:00
GUIDE
0:53
GUIDE Quick Start Menu
1:09
Push Button
1:54
Property Inspector
2:06
Push Button Name
2:26
Edit Callback
3:13
Clock Function
3:56
String Property
6:23
Get Call Back Object (GCBO)
6:31
Set
7:08
Graphical User Interface, Part 2

9m 33s

Intro
0:00
Static Text
0:39
Changing Font
0:59
Push Button
1:10
Edit Text Versus Static Text
1:49
Changing Text2 Tag Name
4:00
Adding Program Routine to MATLAB
4:51
String
5:01
Changing String to Numbers
5:15
Where to Add Program
8:56
Section 10: Dynamical Systems
Dynamical Systems

12m 45s

Intro
0:00
Cantilever Beam
1:10
Examining Flow of Electric Current
1:37
Using MATLAB
2:06
Modulus of Elasticity
4:40
Moment of Inertia
4:48
Equation in MATLAB
5:26
Changing Property of Line Width
6:36
Deflection of Beam Graph
8:06
Electrical Current Figure
8:21
Equation for Finding Relation Between Voltage and Current
9:00
Graph of Solution
12:09
Section 11: Simulation
Examples of Simulation

10m 45s

Intro
0:00
Example: Flipping Coins
0:34
MATLAB Equation
1:18
Changing Value of N
3:14
Example: Roll of Dice
3:49
Example: Random Walk
4:44
Illustration
5:17
MATLAB Equation
7:27
Probability
10:16
Section 12: Numerical Methods
Numerical Methods

22m 20s

Intro
0:00
Integration
0:14
Non-Well Behaved Functions
0:28
Example: Integration
1:18
Trapezoidal Rule
1:47
Numerical Method
5:39
Quad Function
7:41
Symbolic Variables
8:18
Numerical Differentiation
9:15
Diff
10:50
First Order Differential Equation
12:40
Euler’s Method
14:18
Exponential Growth
17:35
Limitations of Euler’s
21:44
Section 13: Simulink
Simulink

9m 37s

Intro
0:00
What is Simulink?
0:04
Simulink Library
0:14
Sine Wave
1:13
Add Noise
1:22
Scope
1:42
Properties
2:18
Limit Data Points
2:37
Configuration Parameters
3:48
MATLAB Demos
4:45
Bouncing Ball Method
5:37
Double Bouncing Ball Method, Animation
7:25
Non-Adaptive Model
8:18
Zero-Crossing Control
8:35
Loading...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of MATLAB
Bookmark & Share Embed

Share this knowledge with your friends!

Copy & Paste this embed code into your website’s HTML

Please ensure that your website editor is in text mode when you paste the code.
(In Wordpress, the mode button is on the top right corner.)
  ×
  • - Allow users to view the embedded video in full-size.
Since this lesson is not free, only the preview will appear on your website.
  • Discussion

  • Study Guides

  • Practice Questions

  • Download Lecture Slides

  • Table of Contents

  • Related Books

Lecture Comments (1)

0 answers

Post by Adegoke Adelabu on June 16, 2014

Hi: Please how can you simulate a satellite orbiting around the earth and showing its ground tracks in a resulting plot after the simulation is done?

Examples of Simulation

  • Simulation is an area of application where computers have come into their own. A simulation is a computer experimentwhich mirrors some aspect of the real world that appears to be based on random processes, or is too complicated to understand properly. (Whether events can be really random is actually a philosophical or theological question.) Some examples are: radioactive decay, rolling dice, bacteria division and traffic flow. The essence of a simulation program is that the programmer is unable to predict beforehand exactly what the outcome of the program will be, which is true to the event being simulated. For example, when you spin a coin, you do not know for sure what the result will be.

Examples of Simulation

Write a program to simulate the spinning coin problem, but in this exercise coin is not fair (i.e. the chance of having head is 60%). Do it for 100 times and display the ratio of number of heads over 100.
H = 0;
T = 0;
N = 100;
for i = 1:N
   r = rand;
    if r  <  0.6
         H = H + 1;
    else
         T = T + 1;
    end
end


disp('Head Percentage = ')
disp(100*H/N)
In a game of Bingo the numbers 1 to 99 are drawn at random from a bag.  Write a script to simulate the draw of the numbers (each number can be drawn only once), printing them ten to a line.
bingo = 1 : 99;
for i = 1 : 99
temp = bingo(i);
swop = floor(rand * 99 + 1);
bingo(i) = bingo(swop);
bingo(swop) = temp;
end
for i = 1 : 10 : 81
disp(bingo(i : i + 9))
end
disp(bingo(91 : 99))
Two players, A and B, play a game called Eights. They take it in turns to choose a number 1, 2 or 3, which may not be the same as the last number chosen (so if A starts with 2, B may only choose 1 or 3 at the next move). A starts, and may choose any of the three numbers for the first move. After each move, the number chosen is added to a common running total. If the total reaches 8 exactly, the player whose turn it was wins the game. If a player causes the total to go over 8, the other player wins. For example, suppose A starts with 1 (total 1), B chooses 2 (total 3), A chooses 1 (total 4) and B chooses 2 (total 6). A would like to play 2 now, to win, but he can�t because B cunningly played it on the last move, so A chooses 1 (total 7). This is even smarter, because B is forced to play 2 or 3, making the total go over 8 and thereby losing. Write a script to simulate each player�s chances of winning, if they always play at random.
counter = 0;
for i = 1:1000

   ChofA = floor(rand*3+1);
   ChofB = floor(rand*3+1);

   while ChofB == ChofA
        ChofB = floor(rand*3+1);
   end

   total = 0;
   if (ChofB hicksim = ChofA) (total  < = 8)
        total = ChofA + ChofB + total;
        temp = floor(rand*3+1);
        while (temp == ChofA)|(temp == ChofB)
             temp = floor(rand*3+1);
       end
       ChofA = temp;
       total = total + ChofA;
   end
   ChofB = floor(rand*3+1);
   ChofA = floor(rand*3+1);
   while ChofA == ChofB
        ChofA = floor(rand*3+1);
   end
   total = total + ChofB;
   if total == 8
        disp('B wins');
        counter = counter +1;
   elseif total  >  8
        disp('A wins');
   elseif total  <  8
        disp('B wins');
        counter = counter +1;
   end
end

disp('chance of B winning: ') disp(100*counter/1000)

*These practice questions are only helpful when you work on them offline on a piece of paper and then use the solution steps function to check your answer.

Answer

Examples of Simulation

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • Example: Flipping Coins 0:34
    • MATLAB Equation
  • Changing Value of N 3:14
  • Example: Roll of Dice 3:49
  • Example: Random Walk 4:44
    • Illustration
    • MATLAB Equation
    • Probability
Educator®

Please sign in to participate in this lecture discussion.

Resetting Your Password?
OR

Start Learning Now

Our free lessons will get you started (Adobe Flash® required).
Get immediate access to our entire library.

Membership Overview

  • Available 24/7. Unlimited Access to Our Entire Library.
  • Search and jump to exactly what you want to learn.
  • *Ask questions and get answers from the community and our teachers!
  • Practice questions with step-by-step solutions.
  • Download lecture slides for taking notes.
  • Track your course viewing progress.
  • Accessible anytime, anywhere with our Android and iOS apps.