Professional Documents
Culture Documents
Experiment no:-1
Aim:-Generate Sin wave, exponential and square response of a sampling frequency 100 Hz
with 20 Number of samples using
Equipments:Operating system:-
Window Xp
Software used:-
Matlab
switch(choice)
case{1}
case{3}
end
xlabel('samples, n'); ylabel('amplitude');
Result:-15
Sine wave
x 10
6
5
amplitude
4
3
2
1
0
-1
-2
-3
10
12
samples, n
14
16
18
20
square wave
1
0.8
Exponential signal
1000
0.6
900
0.4
800
amplitude
700
600
500
400
0
-0.2
-0.4
300
-0.6
200
-0.8
100
0
0.2
1.5
2.5
3.5
4.5
-1
10
samples, n
15
20
25
% Coefficients bk
% Coefficients ak
%----- next part calculates the unit sample response 'impz' function ------------
[h,t] = impz(b,a,n); % This statement calculates unit sample response h(n) of length n
%------ next part displays and sketches the unit sample response ---------------
disp(h);
stem(t,h);
grid on;
xlabel('samples n','color','m');
ylabel('Amplitude h(n)','color','m');
2
1.8
1.6
A m plitude h(n)
1.4
1.2
1
0.8
0.6
0.4
0.2
0
3
4
samples n
Experiment no:-2
Aim :- With the help of Fourier series, make a square wave from sine wave and cosine
waves.
Program:-The Fourier series expansion for a square-wave is made up of a sum of odd
harmonics. We show this graphically using MATLAB.
We start by forming a time vector running from 0 to 10 in steps of 0.1, and take the sine of all
the points. Let's plot this fundamental frequency.
t = 0:.1:10;
y = sin(t);
plot(t, y);
Now add the third harmonic to the fundamental, and plot it.
y = sin(t) + sin(3*t)/3;
plot(t,y);
Now use the first, third, fifth, seventh, and ninth harmonics.
y = sin(t) + sin(3*t)/3 + sin(5*t)/5 + sin(7*t)/7 + sin(9*t)/9;
plot(t,y);
For a finale, we will go from the fundamental to the 19th harmonic, creating vectors of
successively more harmonics, and saving all intermediate steps as the rows of a matrix.
These vectors are plotted on the same figure to show the evolution of the square wave. Note
that Gibbs' effect says that it will never really get there.
t = 0:.02:3.14;
y = zeros(10,length(t));
x = zeros(size(t));
for k=1:2:19
x = x + sin(k*t)/k;
y((k+1)/2,:) = x;
end
plot(y(1:2:9,:)')
title('The building of a square wave: Gibbs'' effect')
Result:-
0.5
-0.5
-1
-1
10
-2
10
0
0
-2
-2
0
10
-4
50
100
150
200
Experiment No:-3
AIM:-Implement the band pass FIR Filter with different cut off frequencies wc1=.25pi, wc2
=.75pi and N=25 using rectangular and Hamming windows and plot their frequency
response.
Software
-Matlab
THEORY:-A Finite Impulse Response (FIR) filter is a discrete linear time-invariant system
whose output is based on the weighted summation of a finite number of past inputs.
an FIR transversal filter structure can be obtained directly from the equation for
discrete-time convolution.
Y(n)=x(k) h(n-k) 0<n<N-1(1)
FIR:-FIR stands for Finite Impulse Response.FIR filters are called as non recursive filters
because they do not use feedback.For every bounded input it produce a bounded output.Thus
FIR filters are inherently stable.
DESIGNING AN FIR FILTER (using window method):
Method I: Given the order N, cutoff frequency fc, sampling frequency fs and the window.
Step 1: Compute the digital cut-off frequency Wc (in the range - < Wc < , with
corresponding to fs/2) for fc and fs in Hz. For example let fc=400Hz, fs=8000Hz
Wc = 2** fc / fs = 2* * 400/8000 = 0.1* radians
For MATLAB the Normalized cut-off frequency is in the range 0 and 1, where 1
corresponds to fs/2 (i.e.,fmax)). Hence to use the MATLAB commands
wc = fc / (fs/2) = 400/(8000/2) = 0.1
Note: if the cut off frequency is in radians then the normalized frequency is computed
as wc = Wc /
Step 2: Compute the Impulse Response h(n) of the required FIR filter using the given
Window type and the response type (lowpass, bandpass, etc). For example given a
rectangular window, order N=20, and a high pass response, the coefficients (i.e., h[n]
samples) of the filter are computed using the MATLAB inbuilt command fir1 as
h =fir1(N, wc , 'high', boxcar(N+1));
Note: In theory we would have calculated h[n]=hd[n]w[n], where hd[n] is the
desired impulse response (low pass/ high pass,etc given by the sinc function) and w[n]
is the window coefficients. We can also plot the window shape as stem(boxcar(N)).
Plot the frequency response of the designed filter h(n) using the freqz function and observe
the type of response (lowpass / highpass /bandpass).
Program:-
Operating System
Windows XP
In this equation, x(k) and y(n) represent the input to and output from the filter at time
n. - h(n-k) is the transversal filter coefficients at time n. These coefficients are
generated by using FDS (Filter Design Software or Digital filter design package).
Clear all
wc1=.25*pi;
wc2=.75*pi;
%cutoff frequencies
N=25;a=(N-1)/2;
eps=.001;
n=0:1:N-1;
hd=(sin(wc2*(n-a+eps))-sin(wc1*(n-a+eps)))./(pi*(n-a+eps));
wr=boxcar(N); %Rectangular window sequence
hn=hd.*wr'; %filter coefficients
w=0:.01:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h));hold on
wh=hamming(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h));
grid;
xlabel('normalised frequency');
ylabel('magnitude');
hold off
Result:1.4
1.2
magnitude
1
0.8
0.6
0.4
0.2
0
0.1
0.2
0.3
0.4
0.5
0.6
normalised frequency
0.7
0.8
0.9
Theory:- A Finite Impulse Response (FIR) filter is a discrete linear time-invariant system
whose output is based on the weighted summation of a finite number of past inputs.
an FIR transversal filter structure can be obtained directly from the equation for
discrete-time convolution.
In this equation, x(k) and y(n) represent the input to and output from the filter at time
n. - h(n-k) is the transversal filter coefficients at time n. These coefficients are
generated by using FDS (Filter Design Software or Digital filter design package).
Experiment no:-6
Aim:- Design a FIR lowpass filter of wc=0.5pi and N=25 using Hamming and Blackman
windows and compare the result..
Equipments:Software:-Matlab
Y(n)=x(k) h(n-k)
0<n<N-1(1)
FIR:-FIR stands for Finite Impulse Response.FIR filters are called as non recursive filters
because they do not use feedback. For every bounded input it produce a bounded output.
Thus FIR filters are inherently stable.
DESIGNING AN FIR FILTER (using window method):
Method I: Given the order N, cutoff frequency fc, sampling frequency fs and the window.
Step 1: Compute the digital cut-off frequency Wc (in the range - < Wc < , with
corresponding to fs/2) for fc and fs in Hz. For example let fc=400Hz, fs=8000Hz
Wc = 2** fc / fs = 2* * 400/8000 = 0.1* radians
For MATLAB the Normalized cut-off frequency is in the range 0 and 1, where 1
corresponds to fs/2 (i.e.,fmax)). Hence to use the MATLAB commands
wc = fc / (fs/2) = 400/(8000/2) = 0.1
Note: if the cut off frequency is in radians then the normalized frequency is computed
as wc = Wc /
Step 2: Compute the Impulse Response h(n) of the required FIR filter using the given
Window type and the response type (lowpass, bandpass, etc). For example given a
rectangular window, order N=20, and a high pass response, the coefficients (i.e., h[n]
samples) of the filter are computed using the MATLAB inbuilt command fir1 as
Program:Clear all
wc=0.5*pi; %cutofffrequency
N=25;
b=fir1(N,wc/pi,hamming(N+1));
w=0:.01:pi;
h=freqz(b,1,w);
plot(w/pi,abs(h));
hold on
b=fir1(N,wc/pi,blackman(N+1));
w=0:.01:pi;
h=freqz(b,1,w);
plot(w/pi,abs(h));grid;
xlabel('normalised frequency');
ylabel('magnitude');
hold off
Result:1.4
1.2
magnitude
1
0.8
0.6
0.4
0.2
0
0.1
0.2
0.3
0.4
0.5
0.6
normalised frequency
0.7
0.8
0.9
Experiment no:-10
Aim:-Generate DTMF sequence 1234567890*# and observe its spectrogram.
Equipments:Software:-Matlab
Operating system:-Window Xp
Throry:- DTMF means: Dual Tone Multiplexed Frequency, the tones you might have heard
while pressing the keys on your telephone. Each key produces a slightly different signal,
which is a mixture of two frequencies, i.e. pressing '1' will send a tone made of 1209 Hz and
697 Hz to the other end of the line.
Program:%generate the 12 frequency pairs
symbol = {'1','2','3','4','5','6','7','8','9','*','0','#'};
lfg = [697 770 852 941]; % Low frequency group
hfg = [1209 1336 1477]; % High frequency group
f = [];
for c=1:4,
for r=1:3,
f = [ f [lfg(c);hfg(r)] ];
end
end
%generate and visulize DTMF tone
f'
Fs = 8000;
% Sampling frequency 8 kHz
N = 800;
% Tones of 100 ms
t = (0:N-1)/Fs; % 800 samples at Fs
pit = 2*pi*t;
tones = zeros(N,size(f,2));
for toneChoice=1:12,
% Generate tone
tones(:,toneChoice) = sum(sin(f(:,toneChoice)*pit))';
% Plot tone
subplot(4,3,toneChoice),plot(t*1e3,tones(:,toneChoice));
title(['Symbol "', symbol{toneChoice},'":
[',num2str(f(1,toneChoice)),',',num2str(f(2,toneChoice)),']'])
set(gca, 'Xlim', [0 25]);
ylabel('Amplitude');
if toneChoice>9, xlabel('Time (ms)'); end
end
set(gcf, 'Color', [1 1 1], 'Position', [1 1 1280 1024])
annotation(gcf,'textbox', 'Position',[0.38 0.96 0.45 0.026],... 'EdgeColor',[1 1 1],...
'String', '\bf Time response of each tone of the telephone pad', ... 'FitHeightToText','on');
Result:Time response of each tone of the telephone pad
Symbol "1": [697,1209]
25
10
15
20
Amplitude
0
10
15
20
0
-2
10
15
Time (ms)
20
25
20
25
10
15
20
10
15
20
10
15
Time (ms)
25
20
25
10
15
20
25
20
25
20
25
10
15
20
15
0
-2
25
10
0
-2
0
-2
25
2
Amplitude
2
Amplitude
15
0
-2
25
10
0
-2
0
-2
25
2
Amplitude
Amplitude
20
0
-2
Amplitude
15
Amplitude
10
Amplitude
0
-2
Amplitude
0
-2
2
Amplitude
0
-2
2
Amplitude
Amplitude
0
-2
10
15
Time (ms)
Experiment no:-7
Aim:- To design and implement IIR (LPF) filter of a given specifications:Pass band attenuation in dB=.4
Stop band attenuation in dB=30
Pass band frequency in Hz=400
Stop band frequency in Hz=800
The IIR filter can realize both the poles and zeroes of a system because it has a
rational transfer function, described by polynomials in z in both the numerator and
the denominator:
bk z-k
ak z-k
The difference equation for such a system is described by the following:
Y (n)= bk x(n-k)+ ak x(n-k)
H(z)=
PROGRAM:
alphap=.4;%passband attenuation in dB
alphas=30;%stopband attenuation in dB
fp=400;%passband frequency in Hz
fs=800;% stopband frequency in Hz
F=2000;%sampling frequency in Hz
omp=2*fp/F;oms=2*fs/F;
%to find cut off frequency and order of the filter
[n,wn]=buttord(omp,oms,alphap,alphas)
%system function of the filter
[b,a]=butter(n,wn)
w=0:.01:pi;
[h,om]=freqz(b,a,w,'whole');
m=abs(h);
an=angle(h);
subplot(2,1,1);plot(om/pi,20*log(m));grid;
xlabel('normalised frequency');
ylabel('gain in dB');
subplot(2,1,2);plot(om/pi,an);grid
xlabel('normalised frequency');
ylabel('phase in radians');
Result:-
gain in dB
200
0
-200
-400
-600
0.1
0.2
0.3
0.4
0.5
0.6
normalised frequency
0.7
0.8
0.9
0.1
0.2
0.3
0.4
0.5
0.6
normalised frequency
0.7
0.8
0.9
phase in radians
4
2
0
-2
-4
AIM:
Software :-
THEORY:
The Fast Fourier Transform is useful to map the time-domain sequence into a
continuous function of a frequency variable. The FFT of a sequence {x(n)} of length
N is given by a complex-valued sequence X(k).
Dividing the DFT into smaller DFTs is the basis of the FFT. A radix-2 FFT divides the
DFT into two smaller DFTs, each of which is divided into smaller DFTs and so on,
resulting in a combination of two-point DFTs. The Decimation -In-Time (DIT) FFT
divides the input (time) sequence into two groups, one of even samples and the other
of odd samples. N/2 point DFT are performed on the these sub-sequences and their
outputs are combined to form the N point DFT
FIG. 3A.1
The above shown mathematical representation forms the basis of N point FFT and is
called the Butterfly Structure.
STAGE I
STAGE - II
STAGE III
FIG. 3A.2 8 POINT DIT
PROGRAM:
%fast fourier transform
clc;
clear all;
close all;
tic;
x=input('enter the sequence');
n=input('enter the length of fft');
%compute fft
disp('fourier transformed signal');
X=fft(x,n)
subplot(1,2,1);stem(x);
title('i/p signal');
xlabel('n >');
ylabel('x(n) -->');grid;
subplot(1,2,2);stem(X);
title('fft of i/p x(n) is:');
xlabel('Real axis >');
ylabel('Imaginary axis ->');grid;
RESULT:
Experiment No:-4
AIM:- To verify and evaluate linear convolution of a sequence x(n)={1,2,3,4,5} and
h(n)={1,2}.
Software used:-Matlab
THEORY:
Theory:
The output y[n] of a LTI (linear time invariant) system can be obtained by convolving
the input x[n] with the systems impulse response h[n].
Algorithm:
1. Input the two sequences as xn, hn
2. Convolve both to get output yn.
3. Plot the sequences.
Experiment:-5
AIM:-To verify and evaluate Circular Convolution of x(n)={1,2,3,4} and h(n)={1,2,3}.
Software:-Matlab
Theory:
As seen in the last experiment, the output y[n] of a LTI (linear time invariant) system
can be obtained by convolving the input x[n] with the systems impulse response h[n].
The above linear convolution is generally applied to aperiodic sequences. Whereas the
Circular Convolution is used to study the interaction of two signals that are periodic.
The linear convolution sum is
y[n] x[n] h[ n]
x[k ]h[
nk
] where
the index n k N implies circular shifting operation and k N implies folding the
sequence circularly.
Steps for circular convolution are the same as the usual convolution, except all index
calculations are done "mod N" = "on the wheel".
o Plot f [m] and h [m] as shown in Fig. 4.1. (use f(m) instead of x(k))
o Multiply the two sequences
o Add to get y[m]
o "Spin" h[m] n times Anti Clock Wise (counter-clockwise) to get h[n-m].
x[n] and h[n] can be both finite or infinite duration sequences. If infinite sequences,
they should be periodic, and the N is chosen to be at least equal to the period. If they
are finite sequences N is chosen as >= to max (xlength, hlength). Whereas in linear
convolution N>= xlength+hlength-1.
Say x[ n] {2,3, 1,1} and N = 5, then the x[-1] and x[-2] samples are plotted at
x[N-1] = x[-4] and x[N-2] =x[-3] places. Now x[n] is entered as x[n] {1,1,0,2,3}
.
clc;
clear all;
close all;
disp('circular convolution program');
x=input('enter i/p x(n):');
m=length(x);
h=input('enter i/p sequence h(n)');
n=length(h);
subplot(2,2,1), stem(x);
title('i/p sequencce x(n)is:');
xlabel(' >n');
ylabel(' >x(n)');grid;
subplot(2,2,2), stem(h);
title('i/p sequencce h(n)is:');
xlabel(' >n');
ylabel(' >h(n)');grid;
disp('circular convolution of x(n) & h(n) is y(n):');
if(m-n~=0)
if(m>n)
`
h=[h,zeros(1,m-n)];
n=m;
end
x=[x,zeros(1,n-m)];
m=n;
end
y=zeros(1,n);
y(1)=0;
a(1)=h(1);
for j=2:n
a(j)=h(n-j+2);
end
%ciruclar conv
for i=1:n
y(1)=y(1)+x(i)*a(i);
end
for k=2:n
y(k)=0;
% circular shift
for j=2:n
x2(j)=a(j-1);
end
x2(1)=a(n);
for i=1:n
if(i<n+1)
a(i)=x2(i);
y(k)=y(k)+x(i)*a(i);
end
end
end
y
subplot(2,2,[3,4]),stem(y);
title('convolution of x(n) & h(n) is:');
xlabel(' >n');
ylabel(' >y(n)');grid;
Result :
Experiment No:-9
X (k ) x[ n]e
j 2kn
N
; k 0,1,2,....N - 1
n 0
The inverse DFT allows us to recover the sequence x[n] from the frequency samples.
j 2kn
1 N 1
N
x[n]
x
[
n
]
e
; n 0,1,2,....N - 1
N k 0
X(k) is a complex number (remember e jw=cosw + jsinw). It has both magnitude and
phase which are plotted versus k. These plots are magnitude and phase spectrum of
x[n]. The k gives us the frequency information.
Here k=N in the frequency domain corresponds to sampling frequency (fs). Increasing
N, increases the frequency resolution, i.e., it improves the spectral characteristics of
the sequence. For example if fs=8kHz and N=8 point DFT, then in the resulting
spectrum, k=1 corresponds to 1kHz frequency. For the same fs and x[n], if N=80
point DFT is computed, then in the resulting spectrum, k=1 corresponds to 100Hz
frequency. Hence, the resolution in frequency is increased.
Since N L , increasing N to 8 from 80 for the same x[n] implies x[n] is still the
same sequence (<8), the rest of x[n] is padded with zeros. This implies that there is no
further information in time domain, but the resulting spectrum has higher frequency
resolution. This spectrum is known as high density spectrum (resulting from zero
padding x[n]). Instead of zero padding, for higher N, if more number of points of x[n]
are taken (more data in time domain), then the resulting spectrum is called a high
resolution spectrum.
Algorithm:
1.
2.
3.
4.
MATLAB Program:
disp(xk);
subplot(2,2,1);
stem(x,'filled');
title('plot of input sequence');
subplot(2,2,2);
stem(real(xk),'filled');
title('plot of real xk');
subplot(2,2,3);
stem(abs(xk),'filled');
title('Magnitude spectrum');
subplot(2,2,4);
stem(angle(xk),'filled');
title('Phase spectrum');
Result:
Columns 4 through 5
-0.3090 + 0.2245i 0.8090 + 2.4899i
EXPERIMENT NO:-11
AIM:- To evaluate IDFT of any given sequence X (k)={3,(2+j),1,(2-j)}.
Theory: The inverse DFT allows us to recover the sequence x[n] from the frequency samples.
j 2kn
1 N 1
x[n]
x[n]e N ; n 0,1,2,....N - 1
N k 0
Where N is chosen such that N>L,where L=length of X[k].
Algorithm:
1.Input the sequence for which IDFT is to be computed.
2. Input the length of the IDFT required (say 4,8,> length of the sequence).
3.Compute the IDFT using ifft command.
4.Plot the magnitude & phase spectrum.
Matlab Program:X=input('enter the sequence=');
n=input('enter the length =');
xn=ifft(x,n);
disp(xn);
subplot(2,2,1);
stem(x,'filled');
title('plot of input sequence');
subplot(2,2,2);
stem(real(xn),'filled');
title('plot of real xn');
subplot(2,2,3);
stem(abs(xn),'filled');
title('magnitude');
subplot(2,2,4);
stem(angle(xn),'filled');
title('phaser');
Result:
enter the sequence=[3,2+j,1,2-j]
enter the length =4
1.0000
0 + 0.5000i
0 - 0.5000i
plot of real xn
1.5
1
0.5
0.5
0
magnitude
phaser
2
1
0.5
0
-1
-2
Experiment no:-12
Aim:-Generate a ASK , FSK and BPSK waveforms for a given input sequence [1 1 1 0 1]
and verify the result.
Software used:-Matlab
Theory:- ASK refers to a type of amplitude modulation that assigns bit values to discrete
amplitude levels. The carrier signal is then modulated among the members of a set of discrete
values to transmit information.
FSK refers to a type of frequency modulation that assigns bit values to discrete frequency
levels. FSK is divided into noncoherent and coherent forms. In noncoherent forms of FSK,
the instantaneous frequency shifts between two discrete values termed the "mark" and
"space" frequencies. In coherent forms of FSK, there is no phase discontinuity in the output
signal. FSK modulation formats generate modulated waveforms that are strictly real values,
and thus tend not to share common features with quadrature modulation schemes.
PSK in a digital transmission refers to a type of angle modulation in which the phase of the
carrier is discretely variedeither in relation to a reference phase or to the phase of the
immediately preceding signal elementto represent data being transmitted. For example,
when encoding bits, the phase shift could be 0 degree for encoding a "0," and 180 degrees for
encoding a "1," or the phase shift could be 90 degrees for "0" and +90 degrees for a "1,"
thus making the representations for "0" and "1" a total of 180 degrees apart. Some PSK
systems are designed so that the carrier can assume only two different phase angles, each
change of phase carries one bit of information, that is, the bit rate equals the modulation rate.
If the number of recognizable phase angles is increased to four, then 2 bits of information can
be encoded into each signal element; likewise, eight phase angles can encode 3 bits in each
signal element.
ASK waveform
FSK waveform
5
4
3
2
1
0
-1
-2
-3
-4
-5
0.5
1.5
2.5
3.5
4.5
disp(n);
for j=1:n
a(j)=input('input bits ');
end
disp(a);
for i=1:n
if a(i)==0
f=5*sin(2*pi*b);
elseif a(i)==1
f=5*sin(6*pi*b);
end
plot(b,f)
b=[i:.001:i+1];
hold on
end
5
4
3
2
1
0
-1
-2
-3
-4
-5
0.5
1.5
2.5
3.5
4.5
if a(i)==0
f=-5*cos(2*pi*b);
elseif a(i)==1
f=5*cos(2*pi*b);
end
plot(b,f)
b=[i:.001:i+1];
hold on
end
5
4
3
2
1
0
-1
-2
-3
-4
-5
0.5
1.5
2.5
3.5
4.5
INRODUCTION
MATLAB: MATLAB is a software package for high performance numerical computation and
visualization provides an interactive environment with hundreds of built in functions for
technical computation, graphics and animation. The MATLAB name stands for MATrix
Laboratory
LinearToolbox
algebra
External interface
Signal processing Image processing
Signal processing
MATLAB
3-D graphics
Interface with C and
Polynomials
& interpolation
Statistics
Control system
Fortran programs
At its core ,MATLAB is essentially a set (a toolbox) of routines (called m files or mex
files) that sit on your computer and a window that allows you to create new variables with
names (e.g. voltage and time) and process those variables with any of those routines (e.g. plot
voltage against time, find the largest voltage, etc).
It also allows you to put a list of your processing requests together in a file and save that
combined list with a name so that you can run all of those commands in the same order at
some later time. Furthermore, it allows you to run such lists of commands such that you pass
in data and/or get data back out (i.e. the list of commands is like a function in most
programming languages). Once you save a function, it becomes part of your toolbox (i.e. it
now looks to you as if it were part of the basic toolbox that you started with).
For those with computer programming backgrounds: Note that MATLAB runs as an
interpretive language (like the old BASIC). That is, it does not need to be compiled. It
simply reads through each line of the function, executes it, and then goes on to the next line.
(In practice, a form of compilation occurs when you first run a function, so that it can run
faster the next time you run it.)
MATLAB Windows:
MATLAB works with through three basic windows
Command Window : This is the main window .it is characterized by MATLAB command
prompt >> when you launch the application program MATLAB puts you in this window all
commands including those for user-written programs ,are typed in this window at the
MATLAB prompt
Graphics window: the output of all graphics commands typed in the command window are
flushed to the graphics or figure window, a separate gray window with white background
color the user can create as many windows as the system memory will allow
Edit window: This is where you write edit, create and save your own programs in files called
M files.
Input-output:
MATLAB supports interactive computation taking the input from the screen and flushing, the
output to the screen. In addition it can read input files and write output files
Data Type: the fundamental data type in MATLAB is the array. It encompasses several
distinct data objects- integers, real numbers, matrices, charcter strings, structures and
cells.There is no need to declare variables as real or complex, MATLAB automatically sets
the variable to be real.
1. T = 0: 1:10
This instruction indicates a vector T which as initial value 0 and final value 10 with
an increment of 1
Therefore T = [0 1 2 3 4 5 6 7 8 9 10]
2. F= 20: 1: 100
3. T= 0:1/pi: 1
4. zeros (1, 3)
The above instruction creates a vector of one row and three columns whose values are
zero
Output= [0 0 0]
5. zeros( 2,4)
Output =
0000
0000
6. ones (5,2)
The above instruction creates a vector of five rows and two columns
Output =
11
11
11
11
11
7. a = [ 1 2 3]
b = [4 5 6]
a.*b = [4 10 18]
if C= [2 2 2]
b.*C results in [8 10 12]
9. plot (t, x)
If
x = [6 7 8 9]
t = [1 2 3 4]
This instruction will display a figure window which indicates the plot of x versus t
2`
11. Subplot: This function divides the figure window into rows and columns
Subplot (2 2 1) divides the figure window into 2 rows and 2 columns 1 represent
number of the figure
1
(2 2 1)
2
(2,2,2)
Subplot(3, 1, 3)
1 (3, 1, 1)
2 (3, 1, 2)
12 Filter
Syntax:
y = filter(b,a,X)
Description: 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.
13. Impz
Syntax: [h,t] = impz(b,a,n)
Description: [h,t] = impz(b,a,n) computes the impulse response of the filter with numerator
coefficients b and denominator coefficients a and computes n samples of the impulse
response when n is an integer (t = [0:n-1]'). If n is a vector of integers, impz computes the
impulse response at those integer locations, starting the response computation from 0 (and t =
n or t = [0 n]).If, instead of n, you include the empty vector [] for the second argument, the
number of samples is computed automatically by default.
14. Fliplr
Syntax: B = fliplr(A)
Description: 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.
15. Conv
Syntax: w = conv(u,v)
Description: w = conv(u,v) convolves vectors u and v. Algebraically, convolution is the same
operation as multiplying the polynomials whose coefficients are the elements of u and v.
16.Disp
Syntax: disp(X)
Description: 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.
17.xlabel
Syntax: xlabel('string')
Description: xlabel('string') labels the x-axis of the current axes.
18. ylabel
Syntax : ylabel('string')
Description: ylabel('string') labels the y-axis of the current axes.
19.Title
Syntax : title('string')
Description: title('string') outputs the string at the top and in the center of the current axes.
20.grid on
Syntax : grid on
Description: grid on adds major grid lines to the current axes.
300-, 225-, 200-MHz (GDP), and 225-, 200-, 167-MHz (PYP) Clock Rates
256K-Byte L2 Memory Total: 64K-Byte L2 Unified Cache/Mapped RAM, and 192KByte Additional L2 Mapped RAM
Device Configuration
Up to 16 transmit pins
Two Inter-Integrated Circuit Bus (I2C Bus) Multi-Master and Slave Interfaces
Serial-Peripheral-Interface (SPI)
AC97 Interface
Package Options:
CMOS Technology
If Code Composer Studio IDE fails to configure your port correctly, perform the following
steps:
Test the USB port by running DSK Port test from the start menu
Code Composer is the DSP industry's first fully integrated development environment (IDE)
with DSP-specific functionality. With a familiar environment liked MS-based C++TM, Code
Composer lets you edit, build, debug, profile and manage projects from a single unified
environment. Other unique features include graphical signal analysis, injection/extraction of
data signals via file I/O, multi-processor debugging, automated testing and customization via
a C-interpretive scripting language and much more.
IDE
Debug IDE
Advanced watch windows
Integrated editor
CCS Procedure:
1. Double click on CCS icon
2. Create a new project: project New
Type the project name (x.pjt) & store in myprojects folder
To open an existing project: project open
3. Files to be added to the project: project Add Files to project
a. c: \ CCStudio \ c6000 \ cgtools \ lib \ rts6700.lib
<Select type of file as: library>
b.
c. Start address upper display x (user defined variable array names used in C
program. Note: x, y should be made global to be used by graph)
d. Start address lower display y
e. Acquisition Buffer size 60 (depends on the array size)
f. Display Buffer size 60
g. DSP data type 32-bit Floating pt
h. Auto scale ON (if off choose max yvalue=1)