# MATLAB Program Design & Algorithm Development

Section 4: Program Design: Lecture 1 | 19:36 min

Lecture Description

In this lesson, our instructor Arash Vafanejad discusses program design and algorithm development. This lesson also features examples of computing projectiles.

Table of Contents

Section 1: Introduction

MATLAB Essentials, Part 1

8m 36s

- Intro0:00
- Purpose of MATLAB0:17
- Interactive Use0:39
- Accessing MATLAB1:50
- MATLAB Command Line2:06
- Navigating MATLAB Page3:24
- Limits3:40
- Predefined Value4:10
- Variables4:48
- Exponentials6:59
- Changing Defined Values7:19
- Whos Function7:45

MATLAB Essentials, Part 2

7m 39s

- Intro0:00
- General Functions0:06
- Date0:09
- Calendar0:14
- Commands0:21
- Command Versus Function0:29
- Scalars Versus Arrays0:50
- Plot Command3:14
- Ezplot3:49
- Help4:30
- Magic (22)5:28
- Plotting 3D Graph6:54

Section 2: MATLAB Fundamentals

Introduction to Programs

6m 42s

- Intro0:00
- Help Function0:09
- Command History1:09
- Navigating1:14
- Current Folder1:20
- Resize and Undocking Windows1:31
- Sample Program1:49
- Example: Interest Calculator3:28
- Interpreter Versus Compiler5:10

Arrays & Matrices

7m 6s

- Intro0:00
- What is a matrix?0:12
- What is vector?0:23
- Initializing Array0:52
- Checking Vector Size1:38
- Using Commas1:56
- Linspace3:06
- Subscript4:40
- Matrices5:53
- Using Semicolon6:07
- Transposing Matrix6:44

Operator, Expression & Statements

13m 26s

- Intro0:00
- Scratchpad0:14
- Expressions0:54
- Numbers1:04
- Eps3:03
- Realmin3:24
- Realmax3:27
- Data Types3:37
- Default Data Types3:44
- Double Precision3:47
- Precedence of Operators4:19
- What Are Arithmetic Operators?4:49
- Combining Operations5:24
- Precedence Rules5:36
- Parenthesis5:53
- Power, Multiplication and Division6:12
- Addition and Subtraction6:18
- Arithmetic Operation on Arrays6:54
- Expressions8:21
- Ans9:09
- Statements9:19
- Multiple Statements11:50

Repeating With For

14m 21s

- Intro0:00
- Repetition0:19
- Newton’s Method1:39
- Factorials4:11
- Limit of a Sequence6:03
- Basic For Construct9:23
- Example: Leaving Out For12:26

Decisions, Part 1

14m 35s

- Intro0:00
- If Function0:13
- Rand0:44
- Meaning of “1” and “0”1:53
- If-Else Construct3:48
- Elseif8:43
- Using Elseif10:44
- Logical Operators12:13
- &, |, ~12:33

Decisions, Part 2

8m 53s

- Intro0:00
- Multiple Ifs Versus Elseif0:09
- Nested Ifs2:24
- Example Nested If2:52
- Vectorizing Ifs4:45
- Switch5:12

Last Notes on MATLAB Introduction

9m 47s

- Intro0:00
- Complex Numbers0:12
- i0:30
- j0:39
- Square Root1:19
- Exponential1:30
- Z1:38
- Absolute Value2:09
- Angle2:11
- Circle2:44
- Axis3:29
- Complex Conjugate Transpose5:24
- Input/ Output5:52
- Input Statement6:48
- Help9:19

Section 3: Logical Vectors

Logical Vectors, Part 1

11m 23s

- Intro0:00
- Executing a Logical Operation1:24
- Vector1:43
- Discontinuous Graphs2:50
- Avoiding Division By Zero5:03
- Epsilon6:35
- Rolling Dice7:49
- Rand8:09
- Floor8:24
- Finding Percentage9:46

Logical Vectors, Part 2

11m 40s

- Intro0:00
- Logical Operators and Vectors0:09
- Logical Functions1:09
- Any1:19
- Exist2:00
- Find(x)2:20
- Defining a New Vector3:31
- Logical Vectors Instead of Elseif Ladders4:35
- Example: Tax4:45
- If ti6:04
- Elseif ti6:25
- Executing in MATLAB7:51
- Example: Using Logical Vector8:21

Section 4: Program Design

Program Design & Algorithm Development

19m 36s

- Intro0:00
- Problem Analysis0:36
- Problem Statement0:57
- Processing Scheme1:06
- Algorithm1:16
- Program Algorithm1:52
- Evaluation2:12
- Application3:11
- Example: Projectile3:54
- Example Executed in MATLAB9:41
- Txmax11:19
- Xmax11:43
- Computing Speed and Angle Direction of Projectile13:27
- Velocity14:11
- Computing Time and Horizontal Distance at Max. Altitude15:05
- Display Altitude16:10
- Num2str16:55
- Plot17:22
- Figure18:25

Section 5: Graphics

Graphics, Part 1

9m 14s

- Intro0:00
- Plot Statement0:27
- Straight Line Graphs2:29
- MATLAB Easy-to-Use Plotting Commands3:38
- Labels4:17
- Example: Label4:36
- Xlabel6:33
- Ylabel6:51
- Line Styles, Markers and Color7:05
- Zooming In9:01

Graphics, Part 2

17m 20s

- Intro0:00
- Multiple Plots on the Same Axis0:07
- Hold On0:53
- Plotyy2:44
- Plot (x) (y)3:34
- Subplots4:39
- Figure9:15
- Graphical Input10:06
- Logarithmic Plots11:48
- Polar Plots12:57
- Fplot14:29

Graphics, Part 3

18m 37s

- Intro0:00
- Comet32:37
- Mesh Surfaces3:02
- Visualizing Vector Fields5:29
- Contour6:49
- Voltage Field and Gradients10:03
- Rotation of 3D Graphs10:30
- Rotation Angles12:30
- Polar Angle13:26
- Pause Command14:37
- Other Cool Graphics Functions14:59
- Area15:14
- Bar16:20
- Compass16:48
- Errorbar17:17

Section 6: Loops

Loops

10m 38s

- Intro0:00
- Powerful Force Statement and Determinate0:11
- Indeterminate Repetition0:36
- Binomial Coefficient0:50
- For Loop2:40
- Determinate Repetition Using For3:40
- Indeterminate Repetition Using While3:49
- A Guessing Game4:12
- Create Steps to Build a Program6:06
- Implement with Syntax in MATLAB6:08
- Fixing Code Error8:44
- Condition and Loop10:00

While

17m 1s

- Intro0:00
- Doubling Time of an Investment0:33
- Create Steps0:57
- Translate Into Code2:22
- Conditions and Loops4:57
- Determinate For Loop Unavailability5:07
- Prime Numbers5:27
- Create Steps6:59
- Compute in MATLAB11:11
- Break and Continue12:05
- Menu13:37
- Menu Window15:27
- Do This and Do That15:33
- Value of K16:44

Section 7: Project

Projectile Problem

16m 33s

- Intro0:00
- Projectile Problem0:12
- Air Resistance3:27
- Location of Projectile4:58
- Example in MATLAB6:20
- Air Friction (k)6:28
- Gravitational Force (g)6:32
- Dt6:41
- Solving Differential Equation10:59
- Determining If/When the Object Hits the Ground11:59
- xhit12:51
- Chart15:39

Section 8: Function M-Files

Function M-Files, Part 1

12m 55s

- Intro0:00
- Type0:21
- Type Sin0:33
- Type Fzero0:55
- M-file Versus Script File1:10
- Inline Objects1:54
- Input Argument4:29
- Function M-file6:01
- Defining Function7:24
- Function Y8:14
- Relative Error9:36
- Creating Finite Steps9:58
- Display10:58

Function M-Files, Part 2

14m 14s

- Intro0:00
- Calculating Mean and Average0:27
- Dummy Variables2:59
- Multiple Input/ Output Arguments4:05
- Function Names4:35
- Adding Comments4:56
- h-1 Line5:31
- Local Variables5:57
- Global Variables6:52
- Defining Global Variables7:15
- Persistent Variables8:17
- Clearing Persistent Variables9:49
- Subfunctions12:12
- P-code Files13:03

Function M-Files, Part 3

11m 54s

- Intro0:00
- Feval2:00
- Example: Rewriting Procedure as Newton Function2:35
- Defining Function2:50
- Overview: How to Use Function5:43
- Command/Function Duality6:18
- Example6:59
- Debugging a Script7:22
- Breakpoint Alley8:02
- Debugging a Function10:09

Section 9: Graphics Continued

More on Graphics

11m 13s

- Intro0:00
- Animation0:07
- Get Frame Function0:33
- Execute in MATLAB1:30
- Movie Function1:44
- Handle Graphics Facility2:29
- Example2:32
- P = Plot4:35
- Xor5:02
- Drawnow5:35
- Creating 3D Plot7:28

Graphical User Interface, Part 1

7m 25s

- Intro0:00
- GUIDE0:53
- GUIDE Quick Start Menu1:09
- Push Button1:54
- Property Inspector2:06
- Push Button Name2:26
- Edit Callback3:13
- Clock Function3:56
- String Property6:23
- Get Call Back Object (GCBO)6:31
- Set7:08

Graphical User Interface, Part 2

9m 33s

- Intro0:00
- Static Text0:39
- Changing Font0:59
- Push Button1:10
- Edit Text Versus Static Text1:49
- Changing Text2 Tag Name4:00
- Adding Program Routine to MATLAB4:51
- String5:01
- Changing String to Numbers5:15
- Where to Add Program8:56

Section 10: Dynamical Systems

Dynamical Systems

12m 45s

- Intro0:00
- Cantilever Beam1:10
- Examining Flow of Electric Current1:37
- Using MATLAB2:06
- Modulus of Elasticity4:40
- Moment of Inertia4:48
- Equation in MATLAB5:26
- Changing Property of Line Width6:36
- Deflection of Beam Graph8:06
- Electrical Current Figure8:21
- Equation for Finding Relation Between Voltage and Current9:00
- Graph of Solution12:09

Section 11: Simulation

Examples of Simulation

10m 45s

- Intro0:00
- Example: Flipping Coins0:34
- MATLAB Equation1:18
- Changing Value of N3:14
- Example: Roll of Dice3:49
- Example: Random Walk4:44
- Illustration5:17
- MATLAB Equation7:27
- Probability10:16

Section 12: Numerical Methods

Numerical Methods

22m 20s

- Intro0:00
- Integration0:14
- Non-Well Behaved Functions0:28
- Example: Integration1:18
- Trapezoidal Rule1:47
- Numerical Method5:39
- Quad Function7:41
- Symbolic Variables8:18
- Numerical Differentiation9:15
- Diff10:50
- First Order Differential Equation12:40
- Euler’s Method14:18
- Exponential Growth17:35
- Limitations of Euler’s21:44

Section 13: Simulink

Simulink

9m 37s

- Intro0:00
- What is Simulink?0:04
- Simulink Library0:14
- Sine Wave1:13
- Add Noise1:22
- Scope1:42
- Properties2:18
- Limit Data Points2:37
- Configuration Parameters3:48
- MATLAB Demos4:45
- Bouncing Ball Method5:37
- Double Bouncing Ball Method, Animation7:25
- Non-Adaptive Model8:18
- Zero-Crossing Control8: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

For more information, please see full course syllabus of MATLAB

Next Lecture

Previous Lecture

## Start Learning Now

Our free lessons will get you started (Adobe Flash

Sign up for Educator.com^{®}required).Get immediate access to our entire library.

## Membership Overview

Unlimited access to our entire library of courses.Learn at your own pace... anytime, anywhere!