Matlab Introduction
Matlab Introduction
INTRODUCTION TO MATLAB
Aim: To familiarize with MATLAB software, general functions and signal processing toolbox functions.
MATLAB stands for MATrix LABoratory produced by Mathworks Inc., USA. It is a matrix-based powerful
software package for scientific and engineering computation and visualization. Complex numerical
problems can be solved in a fraction of the time that required with other high level languages. It
provides an interactive environment with hundreds of built-in functions for technical computation,
graphics and animation. In addition to built-in functions, user can create his/her own functions.
MATLAB offers several optional toolboxes, such as signal processing, control systems, neural networks
etc. It is command driven software and has online help facility.
MATLAB has three basic windows normally: command window, graphics window and edit window.
Command window is characterized by the prompt ‘>>’. All commands and the ready to run program
filename can be typed here. Graphic window gives the display of the figures as the result of the program.
Edit window is to create program files with an extension .m.
Filter(b.a.x) Syntax: Y = filter(b.a.x) and it filters the data in vector x with the
Conv (a,b) Syntax: C = conv (a,b) and it convolves vectors a and b. The
Butter(N,Wn) designs an Nth order lowpass digital Butterworth filter and returns
The filter coefficients in length N+1 vectors B (numerator) and A
z. The cutoff frequency Wn must be 0.0 < Wn < 1.0, with 1.0
Buttord(Wp, Ws, Rp, Rs) returns the order N of the lowest order digital Butterworth filter that
loses no more than Rp dB in the passband and has at least Rs dB of attenuation in the stopband. Wp and
Ws are the passband and stopband edge frequencies, Normalized from 0 to 1(where 1 corresponds to pi
rad/sec).
Cheby1(N,R,Wn) designs an Nth order lowpass digital Chebyshev filter with R decibels of peak-to-
peak ripple in the passband. CHEBY1 returns the filter coefficients in length N+1 vectors B (numerator)
and A (denominator). The cutoff frequency Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding to half
the sample rate.
Cheb1ord(Wp, Ws, Rp, Rs) returns the order N of the lowest order digital Chebyshev Type I filter
that loses no more than Rp dB in the passband and has at least Rs dB of attenuation in the stopband. Wp
and Ws are the passband and stopband edge frequencies, normalized from 0 to 1 (where 1 corresponds
to pi radians/sample)
Cheby2(N,R,Wn) designs an Nth order lowpass digital Chebyshev filter with the stopband ripple R
decibels down and stopband edge frequency Wn. CHEBY2 returns the filter coefficients in length N+1
vectors B (numerator) and A. The cutoff frequency Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding
to half the sample rate.
Cheb2ord(Wp, Ws, Rp, Rs) returns the order N of the lowest order digital Chebyshev Type II filter
that loses no more than Rp dB in the passband and has at least Rs dB of attenuation in the stopband.
Wp and Ws are the passband and stopband edge frequencies.
Abs(x) It gives the absolute value of the elements of x. When x is complex, abs(x) is the complex
modulus (magnitude) of the elements of x.
Angle(H) It returns the phase angles of a matrix with complex elements in radians.
Frequency vector w in radians and the N-point complex frequency response vector h of the filter b/a.
Stem(y) or stem(x,y) It plots the data sequence y as stems from the x axis terminated with circles for
the data value or at the values specified in x.
Vector is plotted versus the rows or columns of the matrix, whichever line up.
Xlabel(‘text’) or ylabel(‘text’) It adds text beside the x-axis/y-axis on the current axis.