0% found this document useful (0 votes)
49 views13 pages

Introduction To MATLAB

The document is an introduction to MATLAB tutorial that covers: 1) MATLAB windows 2) Defining variables, vectors and matrices 3) Arithmetic operators 4) Matrix and array operations 5) Control flow 6) 2-D graphics functions like plot and help 7) Script files 8) Functions for plotting probability mass functions (PMFs) like binopdf and generating samples like binornd 9) Interactive demos for visualizing distributions and samples using tools like disttool and randtool.

Uploaded by

alfonsoalexavier
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views13 pages

Introduction To MATLAB

The document is an introduction to MATLAB tutorial that covers: 1) MATLAB windows 2) Defining variables, vectors and matrices 3) Arithmetic operators 4) Matrix and array operations 5) Control flow 6) 2-D graphics functions like plot and help 7) Script files 8) Functions for plotting probability mass functions (PMFs) like binopdf and generating samples like binornd 9) Interactive demos for visualizing distributions and samples using tools like disttool and randtool.

Uploaded by

alfonsoalexavier
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Introduction to MATLAB

---------Learning by using it

Elec2600 Tutorial 5

Matlab Windows

Elec2600 Tutorial 5

Definition of Variables, Vectors and Matrices

Elec2600 Tutorial 5

Arithmetic Operators

Elec2600 Tutorial 5

Matrix and Array Operations

Elec2600 Tutorial 5

Control Flow

Elec2600 Tutorial 5

2-D graphics
Help Plot

Other function ?
Elec2600 Tutorial 5 7

Script File

Elec2600 Tutorial 5

Matlab Windows

Elec2600 Tutorial 5

MATLAB Functions for Plotting PMFs


disttool; % interactive demo % sample script % parameters of probability distribution n = 15; p = 0.5; xmin = 0; % minimum limit of plot xmax = 20; % maximum limit of plot x = xmin:xmax; % x values y = binopdf(x,n,p); % values of the binomial pmf plot(x,y,'x'); % generate plot

% y y y

other pmfs = geopdf(x,p); = poisspdf(x,a); = unidpdf(x,n);

% geometric RV, X starts from 1 not 0 % Poisson RV % discrete uniform on {1,...,n}

Elec2600 Tutorial 5

10

Screen shot of disttool application:

MATLAB Functions for Plotting PMFs

Elec2600 Tutorial 5

11

MATLAB: Generating Samples


randtool; % interactive demo % sample script % parameters of probability distribution n = 15; p = 0.5; mm = 1; % size of array of samples (Rows) nn = 500; % size of array of samples (Columns) y = binornd(n,p,mm,nn); % generate samples plot(y,'x'); % generate plot axis([0 500 0 15]);

% y y y

other pmfs = geornd(p,mm,nn); = poissrnd(a,mm,nn); = unidrnd(n,mm,nn);

% geometric RV, X starts from 1 not 0 % poisson RV % discrete uniform on {1,...,n}


12

Elec2600 Tutorial 5

Screen shot of randtool application:

MATLAB Functions for Plotting PMFs

Elec2600 Tutorial 5

13

You might also like