Академический Документы
Профессиональный Документы
Культура Документы
Engineering
STUDENT MANUAL
Semester-VI
Digital Signal Processing & Processors
Laboratory
i
Department of Electronics
Engineering
Vision
To foster and permeate higher and quality education with value added engineering,
technology programs, providing all facilities in terms of technology and platforms for all
round development with societal awareness and nurture the youth with international
competencies and exemplary level of employability even under highly competitive
environment so that they are innovative adaptable and capable of handling problems faced
by our country and world at large.
Mission
The Institution is committed to mobilize the resources and equip itself with men and
materials of excellence thereby ensuring that the Institution becomes pivotal center of
service to Industry, academia, and society with the latest technology. RAIT engages
different platforms such as technology enhancing Student Technical Societies, Cultural
platforms, Sports excellence centers, Entrepreneurial Development Center and Societal
Interaction Cell. To develop the college to become an autonomous Institution & deemed
university at the earliest with facilities for advanced research and development programs
on par with international standards. To invite international and reputed national
Institutions and Universities to collaborate with our institution on the issues of common
interest of teaching and learning sophistication.
Quality Policy
Our Quality Policy
It is our earnest endeavour to produce high quality engineering professionals who are
innovative and inspiring, thought and action leaders, competent to solve
problems faced by society, nation and world at large by striving towards very high
standards in learning, teaching and training methodologies.
Our Motto: If it is not of quality, it is NOT RAIT!
Dr. Vijay D. Patil
President, RAES
Department of Electronics
Engineering
Vision
The department envisions that the students of the branch become engineers of
professional character equipped with a strong theoretical and experimental
foundation required for critical thinking, practical engineering skills to face the recent
research and industrial challenges in the field, the ability to work in a team dignity,
and all the qualities that help them accomplish their goals with a zeal for social
awareness.
Mission
Our mission is to facilitate the development of well rounded, educated,
productive, society–focused, creative, adaptive, motivated and ethical individuals
who are well versed in technology and in social and environmental issues.
4. Experiment No. 1 5
5. Experiment No. 2 19
6. Experiment No. 3 22
7. Experiment No. 4 26
8. Experiment No. 5 31
9. Experiment No. 6 35
14 Experiment No. 11 68
15 Experiment No. 12 73
ii
Department of Electronics &
Telecommunication Engineering
List of Experiments
2 To develop elementary signal function modules (m-files) for unit sample, unit step,
exponential and unit ramp sequences
3 Generation of signals . a) Sinusoidal Signals
b) Exponential Signals
c) Square Wave
4 Computation of Discrete Fourier Transform :To compute N point DFT of a given
sequence and to plot magnitude and phase spectrum.
9 To Generate a signal and quantize it to specified number of bits and calculate the
quantization error.
CO6 Student will be able to understand the use and application of DSP processors.
2
Department of Electronics &
Telecommunication Engineering
3
Department of Electronics &
Telecommunication Engineering
EXL602 Digital Signal Theory Practical Tutorial Theory Practical Tutorial Total
Processing &
Processors
Laboratory -- 02 -- -- 01 -- 01
Term Work:
1. Term work assessment must be based on the overall performance of the student with
every experiment graded from time to time. The grades should be converted into marks as
per the Credit and Grading System manual and should be added and averaged.
2. The final certification and acceptance of term work ensures satisfactory performance of
laboratory work and minimum passing marks in term work.
4
Department of Electronics &
Telecommunication Engineering
DSP & P
Experiment No :1
Experiment No. 1
1. Aim: Introduction to MATLAB and Familiarization with MATLAB software.
2. What will you learn by performing this experiment?
5
Department of Electronics &
Telecommunication Engineering
To understand in built functions and user defined functions in MATLAB
4. Theory:
Introduction
Millions of engineers and scientists worldwide use MATLAB® to analyze and design the systems
and products transforming our world. MATLAB is in automobile active safety systems,
interplanetary spacecraft, health monitoring devices, smart power grids, and LTE cellular
networks. It is used for machine learning, signal processing, image processing, computer vision,
communications, computational finance, control design, robotics, and much more.
The MATLAB platform is optimized for solving engineering and scientific problems. The
matrix-based MATLAB language is the world's most natural way to express computational
mathematics. Built-in graphics make it easy to visualize and gain insights from data. A vast
library of pre-built toolboxes lets you get started right away with algorithms essential to your
domain. The desktop environment invites experimentation, exploration, and discovery. These
MATLAB tools and capabilities are all rigorously tested and designed to work together.
MATLAB helps you take your ideas beyond the desktop. You can run your analyses on larger
data sets, and scale up to clusters and clouds. MATLAB code can be integrated with other
languages, enabling you to deploy algorithms and applications within web, enterprise, and
production systems.
Key Features
High-level language for scientific and engineering computing
Desktop environment tuned for iterative exploration, design, and problem-solving
Graphics for visualizing data and tools for creating custom plots
Apps for curve fitting, data classification, signal analysis, control system tuning, and
many other tasks
Add-on toolboxes for a wide range of engineering and scientific applications
Tools for building applications with custom user interfaces
Interfaces to C/C++, Java®, .NET, Python, SQL, Hadoop, and Microsoft® Excel®
Royalty-free deployment options for sharing MATLAB programs with end users
Description
6
Department of Electronics &
Telecommunication Engineering
MATLAB is a high-performance language for technical computing. It integrates computation,
visualization, and programming environment. Furthermore, MATLAB is a modern programming
language environment: it has sophisticated data structures, contains built-in editing and
debugging tools, and supports object-oriented programming. These factors make MATLAB an
excellent tool for teaching and research.
Starting MATLAB After logging into your account, you can enter MATLAB by double-clicking
on the MATLAB shortcut icon (MATLAB 7.0.4) on your Windows desktop. When you start
MATLAB, a special window called the MATLAB desktop appears. The desktop is a window that
contains other windows. The major tools within or accessible from the desktop are:
• The Workspace
When MATLAB is started for the first time, the screen looks like the one that shown in the
Figure 1. Command prompt window is shown in Fig 2.This illustration also shows the default
configuration of the MATLAB desktop. You can customize the arrangement of tools and
documents to suit your needs. Now, we are interested in doing some simple calculations. We will
assume that you have sufficient understanding of your computer under which MATLAB is being
run.
7
Department of Electronics &
Telecommunication Engineering
Using MATLAB as a calculator As an example of a simple interactive calculation, just type the
expression you want to evaluate. Let’s start at the very beginning. For example, let’s suppose you
want to calculate the expression,
1 + 2 × 3.
>> 1+2*3 ans = 7 You will have noticed that if you do not specify an output variable, MATLAB
uses a default variable ans, short for answer, to store the results of the current calculation. Note
that the variable ans is created (or overwritten, if it is already existed). To avoid this, you may
assign a value to a variable or output argument name.
8
Department of Electronics &
Telecommunication Engineering
For example, >> x = 1+2*3 x = 7 will result in x being given the value 1 + 2 × 3 = 7. This
variable name can always be used to refer to the results of the previous computations. Therefore,
computing 4x will result in
>> 4*x
ans = 28.0000
Quitting MATLAB To end your MATLAB session, type quit in the Command Window, or select
File −→ Exit MATLAB in the desktop main menu.
Creating MATLAB variables MATLAB variables are created with an assignment statement. The
syntax of variable assignment is
• manual entry
• built-in functions
• user-defined functions
9
Department of Electronics &
Telecommunication Engineering
Error messages If we enter an expression incorrectly, MATLAB will return an error message. For
example, in the following, we left out the multiplication sign, *, in the following expression
>> x = 10;
>> 5x
??? 5x
Managing the workspace The contents of the workspace persist between the executions of
separate commands. Therefore, it is possible for the results of one problem to have an effect on
the next one. To avoid this possibility, it is a good idea to issue a clear command at the start of
each new independent calculation.
>> clear
The command clear or clear all removes all variables from the workspace. This frees up system
memory. In order to display a list of the variables currently in the memory, type
whos will give more details which include size, space allocation, and class of the variables.
Getting help To view the online documentation, select MATLAB Help from Help menu or
MATLAB Help directly in the Command Window. The preferred method is to use the Help
Browser.
The Help Browser can be started by selecting the ? icon from the desktop toolbar. On the other
hand, information about any command is available by typing >> help Command
The look for command differs from the help command. The help command searches for an exact
function name match, while the look for command searches the quick summary information in
each function for a match. For example, suppose that we were looking for a function to take the
inverse of a matrix. Since MATLAB does not have a function named inverse, the command help
inverse will produce nothing.
Editor/Debugger : Editor/Debugger is used to create and debug M-files, which are programs to
run MATLAB functions. The Editor/Debugger provides a graphical
10
Department of Electronics &
Telecommunication Engineering
user interface for text editing, as well as for M-file debugging. To create or edit an M-file use
File > New or File > Open, or use the edit function.
c) General Commands in MATLAB
The important commands/ functions in MATLAB are as given below :
ylabel(...) and zlabel(...) label the y-axis and z-axis, respectively, of the current axes.
11
Department of Electronics &
Telecommunication Engineering
subplot(2,1,1), plot(income)
subplot(2,1,2), plot(outgo) plots income on the top half of the window and outgo on the
bottom half.
stem(X,Y) plots X versus the columns of Y. X and Y must be vectors or matrices of the
same size. Additionally, X can be a row or a column vector and Y a matrix with length(X)
rows.
12
Department of Electronics &
Telecommunication Engineering
input (Request user input) : The response to the input prompt can be any MATLAB
expression, which is evaluated using the variables in the current workspace.
user_entry = input('prompt') Displays prompt as a prompt on the screen, waits for
input from the keyboard, and returns the value entered in user_entry. user_entry =
input('prompt', 's') returns the entered string as a text variable rather than as a variable
Y = ones(n) Rreturns an n-by-n matrix of 1s. An error message appears if n is not a scalar.
exp (Exponential) :
disp(X) Displays an array, without printing the array name. If X contains a text string,
the string is displayed. Another way to display an array on the screen is to type its name,
but this prints a leading "X=," which is not always desirable. Note that disp does not
display empty arrays.
13
Department of Electronics &
Telecommunication Engineering
xcorr (Cross-correlation) :
y = filter(b,a,X) filters the data in vector X with the filter described by numerator
coefficient vector b and denominator coefficient vector a. If a(1) is not equal to 1, filter
normalizes the filter coefficients by a(1). If a(1) equals 0, filter returns an error.
r = roots(p) which returns a column vector whose elements are the roots of the
polynomial specified by the coefficients row vector p. For vectors, roots and poly are
inverse functions of each other, up to ordering, scaling, and round off error.
sys=tf(MPCobj) The tf function computes the transfer function of the linear controller
ss(MPCobj) as an LTI system in tf form corresponding to the MPC controller when the
constraints are not active. The purpose is to use the linear equivalent control in Control
System Toolbox for sensitivity and other linear analysis.
abs(X) returns an array Y such that each element of Y is the absolute value of the
corresponding element of X.
14
Department of Electronics &
Telecommunication Engineering
Y = fft(X) Y = fft(X) returns the discrete Fourier transform (DFT) of vector X,
computed with a fast Fourier transform (FFT) algorithm.
B = sqrt(X) returns the square root of each element of the array X. For the elements of
B = ceil(A) rounds the elements of A to the nearest integers greater than or equal to A.
For complex A, the imaginary and real parts are rounded independently.
b = fir1(n,Wn) returns row vector b containing the n+1 coefficients of an order n lowpass
FIR filter. This is a Hamming-window based, linear-phase filter with normalized cutoff
frequency Wn. The output filter coefficients, b, are ordered in descending powers of z.
15
Department of Electronics &
Telecommunication Engineering
B = fliplr(A) returns A with columns flipped in the left-right direction, that is, about a
vertical axis.If A is a row vector, then fliplr(A) returns a vector of the same length with the
order of its elements reversed. If A is a column vector, then fliplr(A) simply returns A.
ind = find(X) locates all nonzero elements of array X, and returns the linear indices of
those elements in vector ind. If X is a row vector, then ind is a row vector; otherwise, ind is
a column vector. If X contains no nonzero elements or is an empty array, then ind is an
empty array.
residuez converts a discrete time system, expressed as the ratio of two polynomials, to
partial fraction expansion, or residue, form. It also converts the partial fraction expansion
back to the original polynomial coefficients.
[r,p,k] = residuez(b,a) finds the residues, poles, and direct terms of a partial fraction
expansion of the ratio of two polynomials, b(z) and a(z). Vectors b and a specify the
16
Department of Electronics &
Telecommunication Engineering
coefficients of the polynomials of the discrete-time system b(z)/a(z) in descending powers
of z.
P = angle(Z) returns the phase angles, in radians, for each element of complex array Z.
The angles lie between + π and – π.
Y = log(X) returns the natural logarithm of the elements of X. For complex or negative z,
where z = x +y*i , the complex logarithm is returned.
5. Conclusion :
1. Which MATLAB command generates the solution to the system of equations AX=B?
a. X = A/B c. X = sum(A.*B)
b. X = inv(A)*B d. X = B*A'
2. . Given the following matrices, show the results generated by these MATLAB command
A.*I
1. I = eye(2)
2. A = [1 2; 2 3]
3. What value does the variable q contain after the MATLAB code below executes?
x = 7;
if x <= 3
q = 0;
elseif x > 10
q = 5;
else
q = 2.5;
end
a. 2.5
b. 5
c. 0
17
Department of Electronics &
Telecommunication Engineering
d. 7
e. Nothing is possible
4. The command shown below will produce what text note on the current figure?
Y = 2;
text(2,2,'Y^2');
7. References:
a. Rudra Pratap ., "Getting started with MATLAB ", 4th Edition, Pearson Education.
18
Department of Electronics &
Telecommunication Engineering
DSP & P
Experiment No : 2
Experiment No. 2
1. Aim: To develop elementary signal function modules (m-files) for unit sample, unit step,
exponential and unit ramp sequences
2. What will you learn by performing this experiment?
To generate unit step , ramp and impulse signals
19
Department of Electronics &
Telecommunication Engineering
To understand the use of MATLAB commands.
4. Theory:
Unit Sample ( impulse) Function
δ(n) = 1, n = 0
= 0, n ≠ 0
In sequence form δ(n) ={ 1 0 0 0 …..}
Unit step sequence:
u(n) = 1, n ≥ 0
= 0, n < 0
r(n) = n, n ≥ 0
= 0, n < 0
5. Design Problem : Write a program in MATLAB to generate Unit step , ramp and
impulse signal. Label the outputs appropriately
Zeros( )
Ones( )
Xlabel ( )
Ylabel ( )
20
Department of Electronics &
Telecommunication Engineering
Title( )
Subplot ( )
Input( )
7. Algorithm/ Program:
Write a program in MATLAB to generate Unit step , ramp and impulse signal. Label the
outputs appropriately
8. Simulation Result:
a. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson Education.
b. Oppenheim A., Schafer R., Buck J., "Discrete Time Signal Processing", 2nd Edition,
Pearson Education.
21
Department of Electronics &
Telecommunication Engineering
DSP & P
Experiment No : 3
Generation of Signals
a) Sinusoidal Signal
b) Square Wave
c) Exponential Wave
Experiment No. 3
1. Aim: To generate signals a) Sinusoidal signal b) Square wave c) Exponential signal
2. What will you learn by performing this experiment?
To generate different types of signals as per the specifications
To understand the use of MATLAB commands.
22
Department of Electronics &
Telecommunication Engineering
To understand how to use MATLAB commands for generating Continuous and
Discrete signals.
4. Theory:
Description
Y = sin(X) returns the sine of the elements of X. The sin function operates element-wise on
arrays. The function accepts both real and complex inputs. For real values of X in the interval [-
Inf, Inf], sin returns real values in the interval [-1 ,1]. For complex values of X, sin returns
complex values. All angles are in radians.
Example :
x = -pi:0.01:pi;
stem(x,sin(x)), grid on
Square wave
Description:
x = square(t,duty)
x = square(t) generates a square wave with period 2π for the elements of time
vector t. square(t) is similar to sin(t), but creates a square wave with peaks of ±1 instead of a sine
wave.
x = square(t,duty) generates a square wave with specified duty cycle, duty, which is a number
between 0 and 100. The duty cycle is the percent of the period in which the signal is positive.
Example :
Generate Square Waves
Create a vector of 100 equally spaced numbers from to . Generate a square wave with a
period of .
t = linspace(0,3*pi)';
x = square(t);
stem(t/pi,x)
grid on
23
Department of Electronics &
Telecommunication Engineering
Exponential Sequence
Example :
n=input('Enter the duration of the signal N = ');
a=input ('Enter the scaling factor a = ');
t=0:.1:n-1;
y=exp(a*t);
plot(t,y);
%stem(t,y);
ylabel ('Amplitude');
xlabel ('Time Index');
TITLE ('Exponential Signal');
5. Design Problem : Write a program in MATLAB to generate Sinusoidal signal, Square
wave , and Exponential Signal. Label the outputs appropriately.
y=exp(a*t);
square(t,duty)
linspace(0,3*pi)';
plot(x,sin(x)),
Xlabel ( )
Ylabel ( )
Title( )
Subplot ( )
Input( )
Stem( )
7. Algorithm/ Program:
Write the program based on the examples mentioned above
8. Simulation Results:
24
Department of Electronics &
Telecommunication Engineering
9. Conclusion and Discussion:
This experiments enables us to generate signals like Sine ,Square and exponential. We
also infer that Using plot function continuous signal can be generated
10. QUIZ / Viva Questions:
a. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson Education.
b. Oppenheim A., Schafer R., Buck J., "Discrete Time Signal Processing", 2nd Edition,
Pearson Education.
25
Department of Electronics &
Telecommunication Engineering
DSP & P
Experiment No : 4
Experiment No. 4
1. Aim: To compute N point DFT of a given sequence and to plot magnitude and phase
spectrum..
26
Department of Electronics &
Telecommunication Engineering
2. What will you learn by performing this experiment?
4. Theory:
DFT stands for Discrete Fourier Transform ."FFT algorithms are so commonly employed to
compute DFTs that the term 'FFT' is often used to mean 'DFT' in colloquial settings. Formally,
there is a clear distinction: 'DFT' refers to a mathematical transformation or function, regardless
of how it is computed, whereas 'FFT' refers to a specific family of algorithms for computing
DFTs."
We take N samples from x(t), and those samples can be denoted as x[0], x[1],...,x[n],...,x[N−1].
Since we could think each sample x[n] as an impulse which has an area of x[n]:
Since there are only a finite number of input data, the DFT treats the data as if it were period, and
evaluates the equation for the fundamental frequency:
27
Department of Electronics &
Telecommunication Engineering
Therefore, the Discrete Fourier Transform of the sequence x[n] can be defined as:
Where
5. Design Problem : Compute DFT of the sequence {2,1,4,3}.Plot the magnitude and phase
response.
6. Signal Processing commands used in the program:
28
Department of Electronics &
Telecommunication Engineering
Input ( )
abs( )
angle( )
stem( )
7. Algorithm:
8. Program:
Write the Program to compute DFT of given sequence using the design steps and
algorithm for reference
9. Simulation Result:
2) Magnitude and phase response for the sequence is observed from the plot
3) Angle ( ) and abs( ) functions are the functions in MATLAB to plot the magnitude and
phase response.
1. What is the real part of the N point DFT XR(k) of a complex valued sequence x(n)?
29
Department of Electronics &
Telecommunication Engineering
3.Which of the following is true regarding the number of computations required to
compute DFT at any one value of ‘k’?
a) 4N-2 real multiplications and 4N real additions
b) 4N real multiplications and 4N-4 real additions
c) 4N-2 real multiplications and 4N+2 real additions
d) 4N real multiplications and 4N-2 real additions
12. References:
a. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson Education.
b. Oppenheim A., Schafer R., Buck J., "Discrete Time Signal Processing", 2nd Edition,
Pearson Education.
30
Department of Electronics &
Telecommunication Engineering
DSP & P
Experiment No. :5
Experiment No. 5
1. Aim: To compute Circular convolution of two finite length sequences using DFT/IDFT.
2. What will you learn by performing this experiment?
4. Theory:
Circular Convolution x[n] and h[n] are two finite sequences of length N with DFTs denoted by
X[k] and H[k], respectivel. Let us form the product W[k] = X[k]H[k], and determine the
sequence w[n] of length N for which thethe DFT is W[k].
31
Department of Electronics &
Telecommunication Engineering
First, extend x[n] and h[n] to periodic sequences with period N, x h ˜[n] and [n], respectively. ˜
Then, the periodic convolution of x h ˜[n] and [n] corresponds to multiplication of the correspond
ing periodic sequences of Fourier series coefficients
The periodic sequence for which the DFS coefficients are corresponds to the
periodic extension of the finite length sequence w[n] with period N. We can recover w[n] by
5. Design Problem : Generate the elementary signals Unit step , ramp and impulse signal.
Label the outputs appropriately
6.Signal Processing commands used in the program:
length ( )
subplot( )
fft( )
ifft( )
7. Algorithm/ Program:
32
Department of Electronics &
Telecommunication Engineering
Write the Program to compute circular convolution of given sequences using the design
steps and algorithm for reference.
Algorithm:
If h_length < N ,pad enough number of zeros to h[n], so that the number of
samples in the modified h[n]=N
Take DFT for modified x[n]=x(k)
Take DFT for modified h[n]=H(k)
Compute Y(K)=X(K)*H(K)
Compute y(n)=IDFT(Y(k))
Verify if y[n]=conv(x,h)
Program:
8. Result:
33
Department of Electronics &
Telecommunication Engineering
11. References:
a. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson Education.
b. Oppenheim A., Schafer R., Buck J., "Discrete Time Signal Processing", 2nd Edition,
a. Pearson Education.
DSP & P
Experiment No : 6a
34
Department of Electronics &
Telecommunication Engineering
Experiment No. 6a
1. Aim: To convert a Analog Filter to Digital Filter using
i) Impulse Invariant Transformation (IIT)
ii) Bilinear Transformation(BLT)
.
2. What will you learn by performing this experiment?
35
Department of Electronics &
Telecommunication Engineering
4. Theory:
for
Note that aliasing will occur, including aliasing below the Nyquist frequency to the extent that
the continuous-time filter's response is nonzero above that frequency. The bilinear
transform is an alternative to impulse invariance that uses a different mapping that maps the
continuous-time system's frequency response, out to infinite frequency, into the range of
frequencies up to the Nyquist frequency in the discrete-time case, as opposed to mapping
frequencies linearly with circular overlap as impulse invariance does
The corresponding discrete-time system's impulse response is then defined as the following
36
Department of Electronics &
Telecommunication Engineering
Performing a z-transform on the discrete-time impulse response produces the following discrete-
time system function
Thus the poles from the continuous-time system function are translated to poles at z = e skT. The
zeros, if any, are not so simply mapped.
The bilinear transform (also known as Tustin's method) is used in digital signal
processing and discrete-time control theory to transform continuous-time system representations
to discrete-time and vice versa.
The bilinear transform is a special case of a conformal mapping (namely, the Möbius
transformation), often used to convert a transfer function of a linear, time-invariant(LTI)
filter in the continuous-time domain (often called an analog filter) to a transfer function
of a linear, shift-invariant filter in the discrete-time domain (often called a digital filter although
there are analog filters constructed with switched capacitors that are discrete-time filters). It
maps positions on the axis, , in the s-plane to the unit circle, , in the z-
plane. Other bilinear transforms can be used to warp the frequency response of any discrete-time
linear system (for example to approximate the non-linear frequency resolution of the human
auditory system) and are implementable in the discrete domain by replacing a system's unit
37
Department of Electronics &
Telecommunication Engineering
where is the numerical integration step size of the trapezoidal rule used in the bilinear
transform derivation;[1] or, in other words, the sampling period. The above bilinear approximation
can be solved for or a similar approximation for can be performed.
The inverse of this mapping (and its first-order bilinear approximation) is
The bilinear transform essentially uses this first order approximation and substitutes into the
continuous-time transfer function,
That is
5. Design Problem : Convert a Analog filter with a transfer function H(s)= s+3/(s+1)(s+2)
to Digital filter.
6. Signal Processing commands used in the program:
38
Department of Electronics &
Telecommunication Engineering
Grid on
Pzmap ( )
angle( )
7. Algorithm/ Program:
Write the Program to convert analog filter to a digital filter using IIT and BLT using the
design steps and algorithm for reference
Algorithm:
8. Results
39
Department of Electronics &
Telecommunication Engineering
4.What do you mean by frequency warping?
11. References:
a. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson
Education.
b. Oppenheim A., Schafer R., Buck J., "Discrete Time Signal Processing", 2nd Edition,
Pearson Education.
DSP & P
40
Department of Electronics &
Telecommunication Engineering
Experiment No : 6b
Experiment No. 6b
1. Aim: To implement a IIR Digital Lowpass Butterworth filter using Bilinear
Transformation.
.
2. What will you learn by performing this experiment?
To implement digital low pass filter according to given specifications.
To understand the response of the butterworth filter.
3. Software Required: MATLAB (version 12),Signal Processing toolbox
4. Theory:
The Butterworth filter is a type of signal processing filter designed to have as flat a
frequency response as possible in the passband. It is also referred to as a maximally flat
41
Department of Electronics &
Telecommunication Engineering
magnitude filter. It was first described in 1930 by the British engineer and physicist Stephen
Butterworth in his paper entitled "On the Theory of Filter Amplifiers".
Analog Low-Pass Filter Prototypes
To design an IIR digital low-pass filter from an analog low-pass filter, we must first know how to
design an analog low-pass filter. Historically, most analog filter approximation methods were
developed for the design of passive systems having a gain less than or equal to 1. Therefore, a
typical set of specifications for these filters is as shown in Fig. (a), with the passband
specifications having the form
Another convention that is commonly used is to describe the passband and stopband constraints
in terms of the parameters ε and A as illustrated in Fig. . Two auxiliary parameters of interest are
the discriminator factor,
The three most commonly used analog low-pass filters are the Butterworth, Chebyshev, and
elliptic filters. These filters are described below.
Butterworth Filter
A low-pass Butterworth filter is an all-pole filter with a squared magnitude response given by
42
Department of Electronics &
Telecommunication Engineering
The parameter N is the order of the filter (number of poles in the system function), and Q,. is the
3-dB cutoff frequency. The magnitude of the frequency response may also be written as
where
The frequency response of the Butterworth filter decreases monotonically with increasing Ω ,
and as the filter order increases, the transition band becomes narrower. These properties are
illustrated in Fig. which shows magnitude response for Butterworth filters of orders N = 2 , 4 ,
8 , and 12. Because
Therefore, the poles of G,(s) are located at 2N equally spaced points around a circle of radius
Q,.,
43
Department of Electronics &
Telecommunication Engineering
and are symmetrically located about the jR-axis shows these pole positions for N = 6 and N =
7.
The system function, H,(s), is then formed from the N roots of H a(s)Ha(-s) that lie in the left-
half s-plane. Butterworth filter with Ωc= 1 , the system function has the form
5. Design Problem : Implement a digital low pass butterworth filter for the following
specifications
0.707 ≤ H(ejw) ≤ 1.0 for 0 ≤ ω ≤ 0.3 π
H(ejw) ≤ 0.2 for 0.75π ≤ ω ≤ 0.3 π
3. Determine the order of the filter N required to meet the specifications using the design
formula.
N ≥ ½ log10(1/As2-1/1/Ap2-1)/log(Ωs/Ωp)
Ωc=Ωp/[1/Ap2-1)]1/2N
5. Find poles pk= e j∏(N+1+2k/2N) from k=0 to N-1
6. Using above poles find normalized transfer function
H(s)=1/(s-p0)(s-p1)------
7. Substitute s= s/ Ωc in H(s) to get analog filter transfer function.
8.The system transfer function H(z)is determined by using formula for bilinear
transformation. S =2/T*(1-z-1)/(1+ z-1)
44
Department of Electronics &
Telecommunication Engineering
6. Signal Processing commands used in the program:
[Bn,An] = butter(N,1,’S’)
bilinear(B,A,1/T)
freqz( )
abs( )
angle( )
7. Algorithm/ Program:
Write the Program to implement Lowpass filter using the design steps and algorithm for
reference.
8. Algorithm:
9. Simulation Result:
8. References:
45
Department of Electronics &
Telecommunication Engineering
1. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson Education.
2. Oppenheim A., Schafer R., Buck J., "Discrete Time Signal Processing", 2nd Edition,
Pearson Education.
3. Babu R., "Digital Signal Processing", 4th Edition, Scitech Publications.
4. Sanjit K Mitra., "Digital Signal Processing"
DSP & P
Experiment No : 7
46
Department of Electronics &
Telecommunication Engineering
Experiment No. 7
1. Aim: To implement a IIR Digital Lowpass Chebyshev filter using Bilinear
Transformation.
.
2. What will you learn by performing this experiment?
To implement digital low pass filter according to given specifications.
To understand the response of the Chebyshev filter.
3. Software Required: MATLAB (version 12),Signal Processing toolbox
4. Theory:
Chebyshev Filters
Chebyshev filters are defined in terms of the Chebyshev polynomials:
47
Department of Electronics &
Telecommunication Engineering
----------------------- …… 1
These polynomials may be generated recursively as follows,
with To(x) = 1 and Tl(x) = x. The following properties of the Chebyshev polynomials follow
from Eq. 1
1 . For lxl≤1 the polynomials are bounded by 1 in magnitude, . lTN(x)l≤1and oscillate between
±1.
For lxl > I , the polynomials increase monotonically with x.
2. TN(l) = 1 for all N.
3. TN (0) =± l for N even, and TN (0) = 0 for N odd.
4. All of the roots of TN(x) are in the interval - 1 ≤ x ≤1.
There are two types of Chebyshev filters. A type I Chebyshev filter is all-pole with an equiripple
passband and a monotonically decreasing stopband. The magnitude of the frequency response is
e form
48
Department of Electronics &
Telecommunication Engineering
where
if N is even, and Ha(Ω) = 1 if N is odd. Given the passband and stopband cutofffrequencies,
Ωp, and Ωs, and the passband and stopband ripples, δs , and δp , (or the parameters ε and A),
5. Design Problem : Implement a digital low pass chebyshwv filter for the following
specifications
0.8 ≤ H(ejw) ≤ 1.0 for 0 ≤ ω ≤ 0.2 π
H(ejw) ≤ 0.2 for 0.6π ≤ ω ≤ π
6. Design Steps in design of Low pass Chebyshev filter using Bilinear transformation :
The steps involved in designing Butterworth filter are as follows:
Find the values for the selectivity factor, k, and the discrimination factor, d.
Determine the filter order using the formula
where
construct the system function Ha(s) by taking the N poles of Ga(s) that lie in the left-half
s-plane.
The system transfer function H(z)is determined by using formula for bilinear
transformation. S =2/T*(1-z-1)/(1+ z-1)
7. Signal Processing commands used in the program:
[Bn,An] = cheby(N,1,’S’)
bilinear(B,A,1/T)
freqz( )
49
Department of Electronics &
Telecommunication Engineering
abs( )
angle( )
8. Algorithm/ Program:
Write the Program to implement Chebyshev Lowpass filter using the design steps and
algorithm for reference
Algorithm:
Program:
9. Simulation Result:
2. The Chebyshev-I filter is equi-ripple in pass band and monotonic in the stop band.
a) True
b) False
3. What is the number of minima’s present in the pass band of magnitude frequency
response of a low pass Chebyshev-I filter of order 4?
a) 1
b) 2
50
Department of Electronics &
Telecommunication Engineering
c) 3
d) 4
12. References:
a. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson Education.
b. .Oppenheim A., Schafer R., Buck J., "Discrete Time Signal Processing", 2nd Edition,
Pearson Education.
DSP & P
Experiment No : 8
51
Department of Electronics &
Telecommunication Engineering
Experiment No. 8
1. Aim: To implement a FIR Lowpass filter using :
a)Rectangular Window
b)Hamming Window
c)Hanning Window
d)Blackmann Window and plot the magnitude and phase response using MATLAB.
.
2. What will you learn by performing this experiment?
To implement digital low pass FIR filter according to given specifications.
Effect of windowing techniques on the output response.
3. Software Required: MATLAB (version 12),Signal Processing toolbox
4. Theory: The frequency response of an N th-order causal FIR filter is
52
Department of Electronics &
Telecommunication Engineering
and the design of an FIR filter involves finding the coefficients h(n) that result in a frequency
response that satisfies a given ser of filter specifications. FIR filters have two important
advantages over 1IR filters. First, they are guaranteed to be stable, even after the filter
coefficients have been quantized. Second, they may be easily constrained to have (generalized)
linear phase. Because FIR filters are generally designed to have linear phase, in the following we
consider the design of linear phase FIR filters.
Linear Phase FIR Design Using Windows
Let hd(n) be the unit sample response of an ideal frequency selective filter with linear phase,
Because hd(n) will generally be infinite in length, it is necessary to find an FIR approximation to
Hd(ejw). With the window design method, the filter is designed by windowing the unit sample
response,
where w(n) is a finite-length window that is equal to zero outside the interval 0 ≤ n ≤ N and is
symmetric about its midpoint:
The effect of the window on the frequency response may be seen from the complex convolution
theorem,
Ideally, the main-lobe width should be narrow, and the side-lobe amplitude should be small.
However, for a fixed-length window, these cannot be minimized independently. Some general
properties of windows are as follows:
1. As the length N of the window increases, the width of the main lobe decreases, which results
in a decrease in the transition width between passbands and stopbands. This relationship is given
approximately by
where A f is the transition width, and c is a parameter that depends on the window.
2. The peak side-lobe amplitude of the window is determined by the shape of the window, and it
is essentially independent of the window length.
53
Department of Electronics &
Telecommunication Engineering
3. If the window shape is changed to decrease the side-lobe amplitude, the width of the main
lobe will generally increase. Listed in Table are the side-lobe amplitudes of several windows
along with the approximate transition width and stopband attenuation that results when the given
window is used to design an N th-order low-pass filter.
Table of Some Common Windows
The Peak Side-Lobe Amplitude of Some Common Windows and the Approximate
5. Design Problem : Implement a digital FIR filter for the following specifications
Hd(ω ) = e-jωτ for ω ≤ ωc
= 0 otherwise
The length of the filter should be 7 and ωc = 1rad/sample. use rectangular window.
w = blackman(n)
w = boxcar(n)
w = hamming(n)
w = hanning(n)
freqz( )
abs( )
angle( )
8. Algorithm/ Program:
Write the Program to implement FIR Lowpass filter using the design steps and algorithm
for reference
9. Algorithm:
2. What condition should the unit sample response of a FIR filter satisfy to have
a linear phase?
55
Department of Electronics &
Telecommunication Engineering
3. Which of the following is not suitable either as low pass or a high pass filter?
a) h(n) symmetric and M odd
b) h(n) symmetric and M even
c) h(n) anti-symmetric and M odd
d) h(n) anti-symmetric and M even
13. References:
a. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson Education.
DSP & P
Experiment No. :9
Quantization error
Experiment No. 9
1. Aim: To Generate a signal and quantize it to specified number of bits and calculate the
quantization error.
2. What will you learn by performing this experiment?
4. Theory:
Quantization (rounding)
In practice the sampling process also involves "quantization" in which the signal being
sampled is assigned a discrete value so it can be used inside a computer.
57
Department of Electronics &
Telecommunication Engineering
When a signal is digitized, quantization errors occur. This will be demonstrated below
where the input signal, x, is rounded to one of 8 quantization levels.
58
Department of Electronics &
Telecommunication Engineering
In this diagram the sampled (but not yet quantized) signal is in blue (i.e., x[n]), the sampled
and quantized signal (i.e., xq[n]), and the quantization error (i.e., e[n]) is shown in green.
5. Design Problem : Generate a sinusoidal signal , quantize the signal to 4 bits ,and
calculate the quantization error .
6.Signal Processing commands used in the program:
fprintf ( )
switch
case
floor( )
Algorithm/ Program:
Write the Program in MATLAB using algorithm for reference.
Algorithm:
Program
7. Simulation Result ( show results for all windows)
1. Finite word length effects refer to the quantization effects that are inherent in any
digital implementation of the system, either in hardware or software.
a) True
b) False
59
Department of Electronics &
Telecommunication Engineering
2. . Which of the following are called as finite word length effects?
a) Parameters of the system must be represented with finite precision
b) Computations are truncated to fit in the limited precision constraints
c) Whether the computations are performed in fixed point or floating point arithmetic
d) All of the mentioned
10. References:
1. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson
Education.
DSP & P
Experiment No. 10
1. Aim: Signal Generation Using TMS320C6713 Processor.
5. Theory:
This note describes a digital signal processor (DSP) based waveform generator, which can
generate a sine wave, up to 24 kHz, a square wave, up to 5 kHz, and a triangular wave, up to 12
kHz. A DSP starter kit with Code Composer Studio has been used in the design of a waveform
generator. The waveform generators can also produce periodic arbitrary waveforms and
amplitude modulated signals. Two synchronized signals can be obtained by using the waveform
61
Department of Electronics &
Telecommunication Engineering
generator too. The spectral components of the signals generated are found comparable with a
commercially available signal generator. 1.Launch CCS by double-clicking on its desktop icon.
Create a new project file MLF.pjt by selecting Project ⇒ New and typing MLF as the project
name, as shown in Fig. 3.5. Set Target to TMS320C67XX before clicking on Finish. The new
project file will be saved in the folder, C ⇒ CCStudio v3.1 ⇒ My projects ⇒ MLF. The .pjt file
stores project information on build options, source filenames, and dependencies. The names of
the files used by a project are displayed in the project view window which by default appears at
the left-hand side of the code composer window.
2.For write your C code go to, File ⇒ New ⇒ Source File. Write your C program in this source
file and then go to, File ⇒ Save. And save it in your project directory MLF (make sure it has a .c
extension).
3.For connecting the kit to DSK go to Debug --Connect. And check that the symbol in the
bottom left-hand corner of the CCS window indicates connection to the DSK.
62
Department of Electronics &
Telecommunication Engineering
4. Add required support files to project by first going to, Project ⇒ Add Files to Project
a) Add the source file MLF.c to the project. MLF.c is the top level C source file containing the
definition of function main(). This source file is stored in the folder MLF and must be added to
the project if it is to be used to generate the executable file MLF.out. Select, Project ⇒ Add Files
to Project. And look for files of type C Source Files ( * .c, * .ccc). Open, or double-click on,
MLF.c. It should appear in the Project View window in the Source folder. b)Secondly add .lib file
to our project by going in, C6000 ⇒ dsk6713 ⇒ lib ⇒ dsk6713bsl.lib. Then add this file to our
project. (DSK board support library functions-useful for interfacing to the codec, DIP switches,
and LED’s). c) Also add the header files dsk6713.h in the Project. d) The GEL file dsk6713.gel is
added automatically when you create the project. It initializes the C6713 DSK invoking the
board support library to use the PLL to set the CPU clock to 225 MHz (otherwise the C6713 runs
at 50 MHz by default). Any of the files (except the library files) listed in the project view
window can be displayed (and edited) by double-clicking on their name in the project view
window. If you have not added header in your project then they are added to the project
63
Department of Electronics &
Telecommunication Engineering
Select, Project ⇒ Build options and click on the Compiler tab. Set the following options, as
shown in Fig. 3.7, 3.8, and 3.9. In the Basic category set Target Version to C671x (−mv6710). In
the advanced category set memory models to Far ( memmodel:data=far). In the preprocessor
category set PreDefine symbol to CHIP-6713 and include search path to, C ⇒ CCStudio v3.1 ⇒
C6000 ⇒ dsk6713 ⇒ include and click on OK.
6. First go to, File ⇒ New ⇒ DSP/BIOS Configuration. Then a dialog box will appears, select
the dsk6713.cbd template and click OK. The CBD files shown in dialog box are called seed CDB
files. CDB files are used to configure a great many objects. To make life easier TI provides a
seed files with all boards it ships. Now save your CDB file by, File ⇒ Save As and give it some
name suppose xyz. Rightclick the project icon in the project explorer and go to, Project ⇒ Add
files, then select xyz.cbd file and add it in the project. Click the + sign to source in the Project
64
Department of Electronics &
Telecommunication Engineering
Window to make sure your .c files were added successfully. Also click the + sign next to
DSP/BIOS config to make sure the .CDB file is displayed. The DSP/BIOS configuration tool
creates and modifies a system files called configuration database (.CBD). The graphical user
interface simplifies system design by • Automatically including the appropriate runtime support
libraries. • Automatically handles interrupts vectors and system reset. • Handles system memory
configuration (builds CMD file).
When you add a CDB file to your project, CCS automatically add the C and assembly files in
the project.
7.For building the project select, Project ⇒ Rebuild All as shown in Fig. 3.11. Or press the
toolbar button with the three downward arrows. This creates an executable file MLF.out that can
be loaded into the C6713 processor and run. Note that the commands for compiling, assembling,
and linking are performed with the Build option. A log file cc-build-Debug.log is created that
shows the files that are compiled and assembled, along with the compiler options selected. It also
lists the support functions that are used. The building process causes all the dependent files to be
included (in case one forgets to scan for all the file dependencies). You should see a number of
diagnostic messages, culminating in the message “Build Complete, 0 Errors, 0 Warnings, 0
Remarks ” appear in an output window in the bottom left-hand side of the CCS window. It is
possible that a warning about the Stack Size will have appeared. This can be ignored or can be
suppressed by unchecking the Warn About Output Sections option in the Advanced category of
Linker Build Options. Alternatively, it can be eliminated by setting the Stack Size option in the
Advanced category of Linker Build Options to a suitable value.
65
Department of Electronics &
Telecommunication Engineering
8.If successful, load the .out file to the DSK: as shown in Fig. 3.11 by selecting, File ⇒ Load
Program browse the Debug directory and select the MLF.out file. Then finally Run it by clicking,
Debug ⇒ Run or F5 or the run button
6. Program:
7. Simulation Results :
8. Conclusion:
66
Department of Electronics &
Telecommunication Engineering
b) they provide more predictable bandwidth
c) none of the mentioned
d) both of the mentioned
10. References:
67
Department of Electronics &
Telecommunication Engineering
DSP & P
Experiment No. 11
1. Aim: To design Digital High Pass Butterworth IIR Filters.
68
Department of Electronics &
Telecommunication Engineering
obtained. Then if a Highpass, Bandpass or Bandstop filter is to be designed it can be
accomplished by using Frequency Transformation.
Frequency Transformation are of two types:
i) Analog Frequency Transformation
ii) Digital Frequency Transformation
In analog frequency transformation the analog system function Ha(s) of the prototype
filter is converted into another analog system function of the desired filter. Then by using
any of the mapping techniques it is converted into the digital System function. Whereas
in case of Digital frequency transformation the analog prototype filter is first transformed
to the digital domain , to have a system function H(z). Then by using Frequency
Transformation, it can be converted into desired digital filter.
Analog Frequency Transformation
69
Department of Electronics &
Telecommunication Engineering
5. Design Problem : Design a Butterworth digital High pass IIR Filter by using Bilinear
Transformation by taking T=0.5 sec to satisfy the following specifications.
0.707 ≤ |H(ejw)| ≤ 1.0 ; for 0.65π ≤ w ≤ π
|H(ejw)| ≤ 0.2 ; for 0 ≤ w ≤ 0.45π
Designing IIR digital filter involves the design of equivalent analog filter & then
converting analog filter to digital filter.
First analog Butterworth IIR filter transfer function is determined using the
specifications.
Then, analog transfer function is converted to a digital filter transfer function using,
Bilinear transformation
Find order of the filter,
Obtain cut-off frequency,
With the order of the filter, obtain the transfer function H(s), by substituting s by S/Ω
Convert analog transfer function Ha(s) to digital function H(z), using either impulse
invariance method or bilinear transformation method.
70
Department of Electronics &
Telecommunication Engineering
Buttord()
Butter()
freqz( )
7. Algorithm/ Program:
Write the Program to implement IIR Highpass filter using the design steps and algorithm
for reference
Algorithm:
8. Simulation Result:
4. List the features that make an analog to digital mapping for IIR filter design coefficient.
5. Give the equation for the order of N and cut-off frequency Ωc of butter worth filter.
11. References:
a. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson Education.
72
Department of Electronics &
Telecommunication Engineering
DSP & P
Experiment No. 12
1. Aim: To design Digital Band Pass Butterworth IIR Filters :
73
Department of Electronics &
Telecommunication Engineering
2. What will you learn by performing this experiment?
To implement digital high pass IIR filter according to given specifications.
3. Software Required: MATLAB (version 12),Signal Processing toolbox
4. Theory:
There are basically four types of frequency selective filters viz i)Lowpass filter ii) Highpass
filter iii)Bandpass filter iv)Bandstop filter
We know the design of Low pass filter. This lowpass filter can be considered as a prototype
filter can be considered as a prototype filter and its system function can be obtained. Then if
a Highpass, Bandpass or Bandstop filter is to be designed it can be accomplished by using
Frequency Transformation.
Frequency Transformation are of two types:
iii) Analog Frequency Transformation
iv) Digital Frequency Transformation
In analog frequency transformation the analog system function Ha(s) of the prototype
filter is converted into another analog system function of the desired filter. Then by
using any of the mapping techniques it is converted into the digital System function.
Whereas in case of Digital frequency transformation the analog prototype filter is first
transformed to the digital domain , to have a system function H(z). Then by using
Frequency Transformation, it can be converted into desired digital filter.
74
Department of Electronics &
Telecommunication Engineering
Buttord()
Butter()
freqz( )
75
Department of Electronics &
Telecommunication Engineering
abs()
angle()
7. Algorithm/ Program:
Write the Program to implement IIR Bandpass filter using the design steps and algorithm
for reference.
Algorithm:
4. The low pass, high pass, band pass and band stop filters can be designed by applying a
specific transformation to a normalized low pass filter.
76
Department of Electronics &
Telecommunication Engineering
a) True
b) False
5. What is the pass band gain of a low pass filter with 1- δP as the pass band attenuation?
8. Give the equation for the order of N and cut-off frequency Ωc of butter worth filter.
11. References:
a. Proakis J., Manolakis D., "Digital Signal Processing", 4th Edition, Pearson Education.
APPENDIX
Examples on Matrices
77
Department of Electronics &
Telecommunication Engineering
1. Creating vectors
A = [1 0 4 5 3 9 0 2]
a = [4 5 0 2 0 0 7 1]
Be aware that MATLAB are case sensitive. Vector A and a have different values.
B = [A a]
C = [a, A]
Concatenation is the process of joining small matrices to make bigger ones. In fact,you made
your first matrix by concatenating its individual elements. The pair of square brackets, [ ], is the
concatenation operator.
(c) Generate the following vectors using function zeros and ones:
F = [1 2 3 4 . . . 30]
G = [25 22 19 16 13 10 7 4 1]
V1 = [1 2 3 4 5 6 7 8 9 0]
V2 = [0.3 1.2 0.5 2.1 0.1 0.4 3.6 4.2 1.7 0.9]
78
Department of Electronics &
Telecommunication Engineering
V3 = [4 4 4 4 3 3 2 2 2 1]
(a) Calculate, respectively, the sum of all the elements in vectors V1, V2, and V3.
(b) How to get the value of the fifth element of each vector?
(c) Generate a new vector V4 from V2, which is composed of the first five elements of V2.
Generate a new vector V5 from V2, which is composed of the last five elements of V2.
(d) Derive a new vector V6 from V2, with its 6th element omitted.
Derive a new vector V7 from V2, with its 7th element changed to 1.4.
Derive a new vector V8 from V2, whose elements are the 1st, 3rd, 5th, 7th, and 9th
elements of V2
9-V1
V1*5
V1+V2
V1-V3
V1.*V2
V1*V2
V1.^2
V1.^V3
V1^V3
79
Department of Electronics &
Telecommunication Engineering
V1 == V3
V1>6
V1>V3
V3-(V1>2)
(V1>2) | (V1<6)
any(V1)
all(V1)
3. Using MATLAB help system, click on Help -> MATLAB help or type helpdesk to open the
help files. For description of a single function or command,
type
help command_name on the command line, or use ’search’ in the help window.
help plot
4. Flow control
(a) A = zeros(1,5);
for n = 1:4
for m = 1:3
A = A + n*m;
80
Department of Electronics &
Telecommunication Engineering
end
end
(b) B = [1 0];
if (all(B))
B = B + 1;
elseif (any(B))
B = B + 2;
else
B = B + 3;
end
(c) C = 7:2:22
num = 0;
C = C - 3;
num = num + 1;
end
num
81
Department of Electronics &
Telecommunication Engineering
(b) Situations under which loops can be avoided. Does the set of commands:
for i = 1:20
H(i) = i * 5;
end
H = 1:20;
H = H*5;
for n = 1:100000
x(n) = sin(n*pi/10);
end
n = 1:100000;
x = sin(n*pi/10);
x = 1:5;
y = 6:10;
82
Department of Electronics &
Telecommunication Engineering
g = x+y;
and then save the file as myscript.m under the default path MATLAB/work
(b) Write a function: Create a new m file following the procedure of above. Type in the
commands:
function g = myfunction(x,y)
g = x + y;
myscript
z = myscript
(error?)
83