[PDF] [PDF] Object oriented programming and classes in MATLAB - University of

Object Oriented Programming is the abstraction of ideas and items into data and the methods (functions) that operate on them OOP in MATLAB of a class To use a class one only needs to know the interface to the class (i e the methods of the class)



Previous PDF Next PDF





[PDF] Object-Oriented Programming in MATLAB® Helsinki 28 - MathWorks

Introduction to Object-Oriented MATLAB Antti Löytynoja Demonstration: Procedural Programming ▫ Simulate a bank Why Object-Oriented Programming?



[PDF] Introduction to Object-Oriented Programming in MATLAB - MathWorks

Object-oriented programming in MATLAB – Classes in MATLAB – Advantages of object oriented design – Example: Designing a portfolio tracker ▫ Events in 



[PDF] Introduction to Object-Oriented Programming in MATLAB - MIT

2011 The MathWorks, Inc Introduction to Object-Oriented Programming in MATLAB Jamie Winter Sr Account Manager Abhishek Gupta Application Engineer 



[PDF] Object oriented programming and classes in MATLAB - University of

Object Oriented Programming is the abstraction of ideas and items into data and the methods (functions) that operate on them OOP in MATLAB of a class To use a class one only needs to know the interface to the class (i e the methods of the class)



[PDF] Object Oriented Programming

Outline Types of programming methodologies How to implement OOP in Matlab Data and Functions Classes : two variations built in Matlab 



[PDF] W1005 Intro to CS and Programming in MATLAB Object Oriented

Object Oriented Programming (OOP) Fall 2014 Instructor: Classes in MATLAB • Self-‐ objects ▫ To generate a new object we use a constructor method 3 



[PDF] Introduction to Object-Oriented Programming in MATLAB

Programming in MATLAB By Stuart McGarrity OBJECT-ORIENTED PROGRAMMING (00) APPLIES TO SOFTWARE DEVELOPMENT the standard science 



[PDF] Object oriented programming - Uni Oldenburg

However, it is possible to combine classical control flow with the use of objects • Matlab classes: o In Matlab, every data value is assigned to a class (I have 



[PDF] Object-Oriented Programming

At this point, consider moving your MATLAB programming tasks to object- oriented designs Understand a Problem in Terms of Its Objects Thinking in terms of 

[PDF] matlab object oriented programming pdf

[PDF] matlab plot color coded

[PDF] matlab plot colormap

[PDF] matlab program to calculate fourier series coefficients associated with square wave

[PDF] matlab programming questions and answers pdf

[PDF] matlab programs examples pdf

[PDF] matlab return value from function

[PDF] matlab solve quadratic equation

[PDF] matlab solve simultaneous equations

[PDF] matlab solve system of nonlinear equations multiple solutions

[PDF] matrice carrée d'ordre 1

[PDF] matrice carrée d'ordre 2 inversible

[PDF] matrice carrée d'ordre 3 inversible

[PDF] matrice carrée d'ordre 4

[PDF] matrice carrée d'ordre 5

1

© 2011 The MathWorks, Inc.

Introduction to Object-Oriented

Programming in MATLAB

Jamie Winter

Sr. Account Manager

Abhishek Gupta

Application Engineer

2

Agenda

ƒObject-oriented programming

ƒBasic object-oriented programming

syntax in MATLAB

ƒClasses in MATLAB

3

What is a program?

x = 12 while (x < 100) x = x+1 if (x == 23) disp('Hello') end end Code Data x = 12 while (x < 100) x = x+1 if (x == 23) disp('Hello') end end

Assignment

Looping Test

Increment

Test to Act

Take Action

End End

Actions

4

Progression of Programming Techniques

Algorithm

Data function script command line value variable structure

Level of Abstraction / Sophistication

5

Example: Sensor Array

ƒTransmitting a signal

from a weather balloon

ƒLocating the signal

with a sensor array

ƒComputing the angle of

arrival (AoA) for the signal 6

Procedural Programming

ƒEasy to learn

ƒMinimal planning

ƒThere is no formal

relationship between data and functions.

ƒEvery detail is exposed.

7

Data and Actions to Implement

Actions Data

Compute FFT

Plot results

Determine peaks

Synthesize measurements

Location

Spacing

Reading

Wavelength Number

Frequency

8

Balloon

ƒLocation

Signal

ƒFrequency

ƒWavelength

Sensor

ƒReading

ƒSpacing

ƒNumber

Related Data and Actions

Actions Data

Sensor

ƒSynthesize measurements

ƒDetermine peaks

ƒCompute FFT

ƒPlot results

Location

Spacing

Reading

Wavelength Number

Frequency

Compute FFT

Plot results

Determine peaks

Synthesize measurements

9

Balloon

ƒLocation

Signal

ƒFrequency

ƒWavelength

Grouping Related Data and Actions

Actions Data

Sensor

ƒSynthesize measurements

ƒDetermine peaks

ƒCompute FFT

ƒPlot results

Sensor

ƒSynthesize measurements

ƒDetermine peaks

ƒCompute FFT

ƒPlot results

Class

Sensor

ƒReading

ƒSpacing

ƒNumber

Sensor

ƒReading

ƒSpacing

ƒNumber

10

Progression of Programming Techniques

Algorithm

Data function script command line value variable structure

Level of Abstraction / Sophistication class

(properties) (methods) 11

Object-Oriented Terminology

ƒClass

Outline of an idea

Properties (data)

Methods (algorithms)

ƒObject

Specific example of a class

Instance

An element of

the set object

Defined set class

12

Agenda

ƒObject-oriented programming

ƒBasic object-oriented programming

syntax in MATLAB

ƒClasses in MATLAB

13

Demonstration: Building a Simple Class

ƒDefine a class for

our radar blips

ƒCreate the weather

balloon object

ƒUse the object in

place of the structure 14

Objects

ƒAre easy to create

ƒManage their own data

ƒAre interchangeable

with a structure

No other code changes are required.

Properties behave similar to field names.

15

Sensor

Synthesize measurements

Determine peaks

Compute FFT

Plot results

Demonstration:

Adding Methods to a Class

ƒStart from a sensor class

with existing properties

ƒAdd a method to compute

angle of arrival (AoA)

ƒIntegrate a sensor object

into the existing code 16

Objects with Methods

ƒHave immediate access to

their own data (properties)

ƒAllow you to overload

existing functions

ƒAllow you to perform

custom actions at creation and deletion 17

Agenda

ƒObject-oriented programming

ƒBasic object-oriented programming

syntax in MATLAB

ƒClasses in MATLAB

18

Taking Methods and Properties Further

ƒControl access

ƒCreate constants

ƒMake values interdependent

ƒExecute methods when properties change

19

Demonstration: Applying Attributes

ƒControl access

Access = public

Access = protected

ƒRestrict modification

Constant

Dependent

20

Encapsulation

Sensor

Synthesize

measurements

Determine

Peaks Compute

FFT

Speed of

Light etc.

Noise Ratio

Sensor

Number of Towers

Tower Spacing

Plot Results

Sensor Reading

Compute AoA

21

Sensor

etc.

Noise Ratio

Number of Towers

Tower Spacing

Plot Results

Sensor Reading

Compute AoA

Encapsulation

Number of Towers

Tower Spacing

Synthesize

measurements

Compute

FFT

Speed of

Light

ƒSeparates the interface

from the implementation

ƒSimplifies object use

ƒBecomes a building block

Determine

Peaks 22

Using a Class as a Building Block

All Radar Blips

The Balloon All Moving Radar Blips

The Red Baron

23

Demonstration:

Creating a Moving Target

ƒDefine a new class

for moving blips

ƒInherit from the existing

class for blips

ƒAdd a method

ƒUse the moving blip

Move Blip

Signal

Position

24

Inheritance

ƒSubclass substitutes

for the superclass

ƒAllows re-envisioning

and re-implementing the superclass

ƒBuilds on proven code

ƒAllows inheriting from the base MATLAB classes 25

Object-Oriented Programming in MATLAB

ƒClass definition file describes object behavior

ƒObjects can substitute for structures

ƒApply attributes for a clean interface

ƒBuild on existing classes with inheritance

Extends the matrix-based language to objects

26

Additional Resources

27

Questions and Answers

quotesdbs_dbs14.pdfusesText_20