Professional Documents
Culture Documents
Ex.No:
Date :
GENERATION OF SIGNALS
AIM:
(iv)Plot the sine, cosine, saw tooth and square wave function.
ESSENTIAL REQUIRED:
Hardware: PC
ALGORITHM:
IMPLUSE FUNCTION:
Step2: Give the respect impulse function using zeros and ones function.
STEP FUNCTION:
RAMP FUNCTION:
SINUSOIDAL FUNCTION:
Step3: Get the interval and obtain sinusoidal waveform using sine function.
COSINE FUNCTION
EXPONENTIAL FUNCTION:
SAWTOOTH FUNCTION:
Step3: Subplot and stem the waveform for the given time domain.
SQUARE FUNCTION:
Step3: subplot and stem the waveform for the given time domain.
FLOWCHART:
IMPLUSE FUNCTION:
START
STOP
STEP FUNCTION:
START
STOP
RAMP FUNCTION:
START
STOP
SINUSOIDAL FUNCTION:
START
STOP
COSINE FUNCTION
START
STOP
EXPONENTIAL FUNCTION:
START
STOP
SAWTOOTH FUNCTION:
START
STOP
‘SQUARE FUNCTION:
START
STOP
PROGRAM:
s1= [zeros(1,5),1,zeros(1,5)];
n1=-5:5;
subplot (2,2,1);
stem (n1,s1);
x label ('time');
y label('amplitude');
s2=[zeros(1,5),ones(1,6)];
n2=-5:5;
subplot(2,2,2);
stem(n2,s2);
xlabel('time');
ylabel('amplitude');
n4=0:n3;
subplot(2,2,3);
stem(n4,n4);
xlabel('time');
ylabel('amplitude');
n5=0:0.1:1;
subplot(2,2,4);
stem(n5,exp(n5));
xlabel('time');
ylabel('amplitude');
t1=0:0.1:1;
y1=sawtooth(2*pi*t1);
subplot(1,2,1);
stem(t1,y1);
xlabel('time ');
ylabel('amplitude');
t2=0:0.1:1;
y2=square(2*pi*t2);
subplot(1,2,2);
stem(t2,y2);
xlabel('time');
ylabel('amplitude');
clear all;
close all;
f=input('enter frequency');
t1=0:0.1:2;
y=vm*cos(2*pi*f*t1);
stem(t1,y);
title('cos wave');
xlabel('time');
ylabel('amplitude');
clc;
clear all;
close all;
f=input('enter frequency');
t1=0:0.1:2;
y=vm*sin(2*pi*f*t1);
stem(t1,y);
title('sine wave');
xlabel('time');
ylabel('amplitude');
OUTPUT:
amplitude
0.5 0.5
0 0
-5 0 5 -5 0 5
time time
unit ramp function exponential function
3 3
2 2
amplitude
amplitude
1 1
0 0
0 1 2 3 0 0.5 1
time time
0.6 0.8
0.6
0.4
0.4
0.2
0.2
0
amplitude
amplitude
0
-0.2
-0.2
-0.4
-0.4
-0.6
-0.6
-0.8 -0.8
-1 -1
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
time time
Enter frequency: 1
cos wave
3
1
amplitude
-1
-2
-3
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
time
Enter frequency: 1
sine wave
3
1
amplitude
-1
-2
-3
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
time
RESULT:
Thus the MATLAB program to generate the various sequences and waves were executed
and the results are obtained.
Ex.No:
Date :
AIM:
ESSENTIALS REQUIRED:
ALGORITHM:
FLOWCHART:
START
Y1=x1*h1
STOP
START
Y1=x1*h1
STOP
clc;
len1=length(x);
n1=0:1:len1-1;
subplot(3,1,1);
stem(n1,x);
xlabel('time period');
ylabel('amplitude');
len2=length(h);
n2=0:1:len2-1;
subplot(3,1,2);
stem(n2,h);
n3=0:1:len-1;
x1=fft(x,len);
h1=fft(h,len);
y=x1.*h1;
xlabel('time period');
ylabel('amplitude');
len=len1+len2-1;
y=ifft(y,len);
subplot(3,1,3);
disp('convoluted sequence');
disp(y);
stem(n3,y);
xlabel('time period');
ylabel('amplitude');
OUTPUT:
convolued sequence
Columns 1 through 9
Columns 10 through 15
-1
1 2 3 4 5 6 7 8
time index
impulse response h(n)
4
amplitude
0
1 2 3 4 5 6 7 8
time index
convolued sequence y(n)
10
amplitude
-10
0 2 4 6 8 10 12 14
time index
%CIRCULAR CONVOLUTION:
clc;
len1=length(xn);
n1=0:1:len1-1;
subplot(3,1,1);
stem(xn);
len2=length(hn);
subplot(3,1,2);
stem(hn);
len=len1+len2-1;
N=len;
x=[xn zeros(1,N-len1)];
n1=length(x);
h=[hn zeros(1,N-len2)];
n2=length(h);
x1=fft(x,len);
h1=fft(h1,len);
y1=x.*h1;
y=ifft(y,len);
subplot(3,1,1);
disp('convoluted sequence');
disp(y);
n=0:1:len-1;
subplot(3,2,1);
stem(n,y);
xlabel('time period');
ylabel('amplitude');
title('convoluted sequence');
Output:
convoluted sequence
Columns 1 through 5
Columns 6 through 7
convoluted sequence
0.5
amplitude
-0.5
-1
0 2 4 6
time period
1
-1
1 1.5 2 2.5 3 3.5 4
convolued sequence y(n)
2
amplitude
-2
0 1 2 3 4 5 6
time index
RESULT:
Thus the MATLAB program to perform (i) linear convolution using FFT
(ii) circular convolution using FFT has been written and the output sequence is obtained.
Ex.No:
Date :
SAMPLING AND EFFECT OF ALIASING
AIM:
To write a MATLAB code to explain sampling a continuous time signal also obtains a graph
to obtain aliasing in time domain and frequency domain.
ESSENTIAL REQUIRED:
ALGORITHM:
Step 1: Initialize the continuous time variable to the range between 0 and 1.
Step 4: Display and obtain the sampling frequency > the nyquist rate of ct signal.
Step 5: Compute the sampling period and allow the time variable of the sampled signal to range
between 0 and 1 in the range of sampling period.
Step 6: Compute the sampled signal and display it if fc < nyquist rate then go to step 8.
Step 7: Obtain the sampling and frequency less than nyquist rate as input and repeat 5&6.
Step 8: Compute the dft of sampled signal for both cases and display it.
FLOW CHART:
START
INITIALISE CT VARIABLE
0:0.001:1
Display
x=cos(2*pi*f*t)
Input fs>=2fm
ts=1/(fs)
x(n)=cos(2*pi*f*t)
Input fs<2fm
tsln=1/(fsln)
x(n)=cos(2*pi*f*tln)
display
STOP
t=0:0.001:1;
x=cos(2*pi*f*t);
subplot(3,1,1);
plot(t,x);
ylabel('signal x(t)');
ts=1/fs;
t=0:ts:1;
xn=cos(2*pi*f*t);
subplot(3,1,2);
stem(t,xn);
tsln=1/fsln;
tln=0:tsln:1;
xln=cos(2*pi*f*tln);
subplot(3,1,3);
stem(tln,xln);
ylabel('amplitude');
figure;
xnf=fft(xn);
subplot(2,2,1);
plot(abs(xnf));
xlabel('index n');
ylabel('amplitude');
xlnf=fft(xln);
subplot(2,1,2);
plot(abs(xlnf));
xlabel('index n');
ylabel('amplitude');
OUTPUT:
0
continuous time signal
1
signal x(t)
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0 time index t
time index t
discrete time signal x(n)
-1
0 0.1 0.2 0.3 0.4 0.5
Analog signal0.6at nyquist
time index t
0.7 0.8
rate 0.9 1
00
-1
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0 0.1 0.2 0.3 time0.4
index t 0.5 0.6 0.7 0.8 0.9 1
time index t
Analog signal samples less than nyquist rate
1
amplitude
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
time index t
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
time index t
20
amplitude
10
0
0 20 40 60
index n
frequency domain of signal aliased at a frequency less than nyquist rate
10
8
amplitude
0
0 5 10 15 20 25
index n
RESULT:
Thus the MATLAB program to explain the concept of sampling a continuous time signal
was written and graph to explain aliasing in time domain and in frequency domain was written.
Ex.No :
Date :
AIM:
To design and plot the FIR filter using hamming, hanning and Blackman window
techniques.
ESSENTIAL REQUIRED:
Hardware:PC or compatible
ALGORITHM:
HAMMING WINDOW:
Step 1: For the given length N, calculate alpha= (N-1)/2 and assign eps=0.001 and
wc=0.5*pi.
Step4: Calculate unit sample response (hn) as delayed sample tresponse(hd) multiplied by resonant
frequency wr.
Step5: Calculate the frequency of unit sample response and plot it.
Step6: Calculate the hamming window coefficients (wn) using hamming function.
HANNING WINDOW
Step1: For the given length N. calculate alpha= (N-1)/2 and assign eps=0.001 and cut off
frequency wc=0.3*pi.
Step6: Calculate the hanning window coefficient (wh) using hanning functions.
BLACKMANN WINDOW:
wc=0.7*pi.
Step7:Calculate hn=hd.*wp’.
FLOWCHART:
HAMMING WINDOW:
START
h(n)
STOP
HANNING WINDOW:
START
h(n)
STOP
BLACKMANN WINDOW:
START
h(n)
STOP
PROGRAM:
clear all;
wc=0.7*pi;
N=9;
alpha=(N-1)/2;
eps=0.001;
n=0:1:N-1;
hd=sin(wc*(n-alpha+eps))./(pi*(n-alpha+eps));
wr=boxcar(N);
hn=hd.*wr';
w=0:0.1:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h));
hold on;
wh= blackman(N);
hn=hd.*wh';
w=0:0.1:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h),'-*');
grid;
xlabel('normalised frequency');
ylabel('amplitude');
title('blackman window');
hold off;
OUTPUT:
clear all;
wc=0.5*pi;
N=9;
alpha=(N-1)/2;
eps=0.0001;
n=0:1:N-1;
hd=sin(wc*(n-alpha+eps))./(pi*(n-alpha+eps));
wr=boxcar(N);
hn=hd.*wr';
w=0:0.1:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h));
hold on;
wh= hamming(N);
hn=hd.*wh';
w=0:0.1:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h),'-*');
grid;
xlabel('normalised frequency');
ylabel('magnitude');
title('hamming window');
hold off;
OUTPUT:
clear all;
wc=0.3*pi;
N=9;
alpha=(N-1)/2;
eps=0.001;
n=0:1:N-1;
hd=sin(wc*(n-alpha+eps))./(pi*(n-alpha+eps));
wr=boxcar(N);
hn=hd.*wr';
w=0:0.1:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h));
hold on;
wh= hanning(N);
hn=hd.*wh';
w=0:0.1:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h),'-*');
grid;
xlabel('normalised frequency');
ylabel('magnitude');
title('hanning window');
hold off;
OUTPUT:
RESULT:
Thus the FIR filter is designed and plotted using hamming, hanning and blackmann window
techniques.
Ex.No :
Date :
AIM:
To write a MATlab program to design a Butterworth low pass, high pass, band pass and band
reject filter.
ESSENTIALS REQUIRED:
Hardware: pc or compatible
ALGORITHM:
Step4: Calculate cutoff frequency and order of the filter using buttord function.
Step4: Calculate cutoff frequency and order of the filter using buttord function.
FLOWCHART:
Start
Assign w=0:0.01:pi
Stop
clear all;
alphap=4;
alphas=30;
fp=400;
fs=800;
f=2000;
omp=2*fp/f;
oms=2*fs/f;
%to find the cutoff 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: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');
OUTPUT:
Start
Assign w=0:0.01: pi
Stop
clear all;
alphap=0.4;
alphas=30;
fp=400;
fs=800;
f=2000;
omp=2*fp/f;
oms=2*fs/f;
%to find the cutoff frequency and order of the filter
[n,wn]=buttord(omp,oms,alphap,alphas)
%system function of the filter
[b,a]=butter(n,wn,'high');
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log(abs(h));
an=angle(h);
subplot(2,1,1);
plot(om/pi,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');
OUTPUT:
Start
Calculate wp=[0.2*pi,0.4*pi],ws=[0.1*pi,0.5*pi].
Assign w=0:0.01:pi
Display butterworth
bandpass filter response
Stop
clear all;
alphap=2;
alphas=20;
wp=[0.2*pi,0.4*pi];
ws=[0.1*pi,0.5*pi];
%to find the cutoff frequency and order of the filter
[n,wn]=buttord(wp/pi,ws/pi,alphap,alphas)
%system function of the filter
[b,a]=butter(n,wn);
w=0:0.01:pi;
[h,ph]=freqz(b,a,w);
m=20*log(abs(h));
an=angle(h);
subplot(2,1,1);
plot(ph/pi,m);
grid;
xlabel('normalised frequency');
ylabel('gain in dB');
subplot(2,1,2);
plot(ph/pi,an);
grid;
xlabel('normalised frequency');
ylabel('phase in radians');
OUTPUT:
Start
Calculate wp=[0.2*pi,0.4*pi],ws=[0.1*pi,0.5*pi].
Assign w=0:0.01:pi
Stop
clear all;
alphap=2;
alphas=20;
wp=[0.2*pi,0.4*pi];
ws=[0.1*pi,0.5*pi];
%to find the cutoff frequency and order of the filter
[n,wn]=buttord(wp/pi,ws/pi,alphap,alphas)
%system function of the filter
[b,a]=butter(n,wn,'stop');
w=0:0.01:pi;
[h,ph]=freqz(b,a,w);
m=20*log(abs(h));
an=angle(h);
subplot(2,1,1);
plot(ph/pi,m);
grid;
xlabel('normalised frequency');
ylabel('gain in dB');
subplot(2,1,2);
plot(ph/pi,an);
grid;
xlabel('normalised frequency');
ylabel('phase in radians');
OUTPUT:
RESULT:
Thus the MATLAB program to design a Butterworth low pass, high pass, band pass and
band reject filter is performed and graph is drawn.
Ex.No :
Date :
DESIGN OF IIR FILTER USING CHEBYCHEV TECHNIQUE
AIM:
To write a MATLAB program to design a chebychev IIR filter low pass, band pass and band
reject filter.
ESSENTIAL REQUIRED:
Hardware: PC or Compatible
ALGORITHM:
Step4: Calculate the cutoff frequency and the order of the filter.
Step4: Calculate the cutoff frequency and the order of the function
Step4: Calculate the cutoff frequency and the order of the function.
Step4: Calculate the cutoff frequency and the order of the filter.
FLOW CHART:
Start
Assign w=0:0.01:pi
Stop
Start
Calculate wp=[0.2*pi,0.4*pi]&
ws=[0.1*pi,0.5*pi]
Assign w=0:0.01:pi
Stop
PROGRAM:
clear all;
alphap=1;
alphas=15;
wp=0.2*pi;
ws=0.3*pi;
[n,wn]=cheb1ord(wp/pi,ws/pi,alphap,alphas);
[b,a]=cheby1(n,alphap,wn);
w=0:0.01:pi;
[h,ph]=freqz(b,a,w);
m=20*log(abs(h));
an=angle(h);
subplot(2,1,1);
plot(ph/pi,m);
grid;
ylabel('Gain in dB');
xlabel('Normalised frequency');
subplot(2,1,2);
plot(ph/pi,an);
grid;
ylabel('Phase in radians');
xlabel('Normalised frequency');
clear all;
alphap=1;
alphas=15;
wp=0.2*pi;
ws=0.1*pi;
[n,wn]=cheb1ord(wp/pi,ws/pi,alphap,alphas);
[b,a]=cheby1(n,alphas,wn,'high');
w=0:0.01:pi;
[h,ph]=freqz(b,a,w);
m=abs(h);
an=angle(h);
subplot(2,1,1);
plot(ph/pi,m);
grid;
ylabel('Gain in dB');
xlabel('Normalised frequency');
subplot(2,1,2);
plot(ph/pi,an);
grid;
ylabel('Phase in radians');
xlabel('Normalised frequency');
clear all;
alphap=2;
alphas=20;
wp=[0.2*pi,.4*pi];
ws=[0.1*pi,.5*pi];
[n,wn]=buttord(wp/pi,ws/pi,alphap,alphas);
[b,a]=cheby1(n,alphap,wn);
w=0:0.01:pi;
[h,ph]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(ph/pi,m);
grid;
ylabel('Gain in dB');
xlabel('Normalised frequency');
subplot(2,1,2);
plot(ph/pi,an);
grid;
ylabel('Phase in radians');
xlabel('Normalised frequency');
clear all;
alphap=2;
alphas=20;
wp=[0.2*pi,.4*pi];
ws=[0.1*pi,.5*pi];
[n,wn]=cheb2ord(wp/pi,ws/pi,alphap,alphas);
[b,a]=cheby2(n,alphas,wn,'stop');
w=0:0.01:pi;
[h,ph]=freqz(b,a,w);
m=20*log(abs(h));
an=angle(h);
subplot(2,1,1);
plot(ph/pi,m);
grid;
ylabel('Gain in dB');
xlabel('Normalised frequency');
subplot(2,1,2);
plot(ph/pi,an);
grid;
ylabel('Phase in radians');
xlabel('Normalised frequency'
OUTPUT:
-200
Gain in dB
-400
-600
-800
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency
low pass filter
4
Phase in radians
-2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency
-100
Gain in dB
-200
-300
-400
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency
band pass filter
4
Phase in radians
-2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency
-50
Gain in dB
-100
-150
-200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency
band reject filter
4
Phase in radians
-2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency
0.5
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency
high pass filter
4
Phase in radians
-2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency
RESULT:
Thus the MATLAB program to design and plot the low pass, high pass, band pass, band
reject using chebyshev filter technique and the output is verified.
Ex.No :
Date :
CALCULATION OF FFT OF A SIGNAL
AIM:
ESSENTIALS REQUIRED:
Hardware: pc or compatible
ALGORITHM:
Step9: Use angle command to obtain the phase plot and plot it.
Step9: Use angle command to obtain the phase plot and plot it.
FLOW CHART:
Start
abs command
Stop
Start
abs command
Stop
PROGRAM:
%COMPUTATION OF DFT
n=length(x);
y=fft(x,n);
subplot (2,2,1);
stem (1:n,real(y));
xlabel('Index k');
ylabel('real of x(k)');
subplot (2,2,2);
stem (1:n,imag(y));
xlabel('index of k');
ylabel('imag of x(k)');
m=abs(y);
subplot (2,2,3);
stem (m);
xlabel('index of f');
ylabel('magnitude of x(k)');
disp(real(y));
disp('imag of x(k)');
disp(imag(y));
disp('Magnitude of x(k):');
disp(m);
p=angle(y);
subplot (2,2,4);
stem (p);
xlabel('index of k');
ylabel('phase of x(k)');
disp('phase of x(k):');
disp(p);
INPUT:
imag of x(k)
Magnitude of x(k):
phase of x(k):
OUTPUT:
10 2
imag of x(k)
real of x(k)
5 0
0 -2
-5 -4
1 2 3 4 5 1 2 3 4 5
Index k index of k
magnitude of x(k): phase of x(k)
15 4
magnitude of x(k)
2
phase of x(k)
10
0
5
-2
0 -4
1 2 3 4 5 1 2 3 4 5
index of f index of k
%COMPUTATION OF IDFT
clc;
clear all;
close all;
n=length(x);
y=ifft(x,n);
subplot(2,2,1);
stem(1:n,real(y));
xlabel('index of k');
ylabel('real of x(k)');
subplot(2,2,2);
stem(1:n,imag(y));
xlabel('index of k');
ylabel('imaginary of x(k)');
m=abs(y);
subplot(2,2,3);
stem(m);
title('magnitude of x(k)');
xlabel('index of f');
ylabel('real of x(k)');
disp('real of x(k)');
disp(real(y));
disp('imaginary of x(k)');
disp(imag(y));
disp('magnitude of x(k)');
disp(m);
p=angle(y);
subplot(2,2,4);
stem(p);
title('phase of x(k)');
xlabel('index of k');
ylabel('real of x(k)');
disp('phase of x(k)');
disp(p);
INPUT:
real of x(k)
5 -1 -1 -1
imaginary of x(k)
0 -1 0 1
magnitude of x(k)
phase of x(k)
OUTPUT:
4 0.5
real of x(k)
2 0
0 -0.5
-2 -1
1 2 3 4 1 2 3 4
index of k index of k
magnitude of x(k) phase of x(k)
6 4
2
real of x(k)
real of x(k)
4
0
2
-2
0 -4
1 2 3 4 1 2 3 4
index of f index of k
RESULT:
Thus the computation of N-point DFT and IDFT was done and the output was obtained.
Ex.No:
Date :
WAVEFORM GENERATION
AIM:
ESSENTIALS REQUIRED:
PROGRAM:
.mmregs
.text
start:
ldp #100h
loop: sacl 0
cmpl
b loop
.end
AMPLITUDE .SET 4
TEMP .SET 0
.mmregs
.text
START:
LDP #100H
splk #0,TEMP
CONT1:
lar AR2,#FREQ
CONT:
out TEMP,4
LACC TEMP
ADD #AMPLITUDE
SACL TEMP
MAR *,AR2
BANZ CONT,*-
LAR AR2,#FREQ
CONTx:
OUT TEMP,4
LACC TEMP
SUB #AMPLITUDE
SACL TEMP
MAR *,AR2
BANZ CONTx
B CONT1
.end
Sine Wave Generation. With these default values sine generated is 100 Hz.
AMPLITUDE .set 5
;different steps;
TEMP .set 0
TEMP1 .set 1
.mmregs
.text
START:
LDP #100H
CONT:
CALL DELAY
LT TEMP1
MPY #AMPLITUDE
PAC
SACL TEMP1
mar *,ar3
banz repeat,*-
LACC TEMP
repeat:
MAR *,AR2
BANZ CONT,*-
b START
DELAY:
lar ar7,#delay
mar *,ar7
ret
TABLE
.word 100
.word 101
.word 103
.word 105
.word 106
.word 108
.word 110
.word 112
.word 113
.word 115
.word 117
.word 119
.word 120
.word 122
.word 124
.word 125
.word 127
.word 129
.word 130
.word 132
.word 134
.word 135
.word 137
.word 139
.word 140
.word 142
.word 143
.word 145
.word 146
.word 148
.word 150
.word 151
.word 152
.word 154
.word 155
.word 157
.word 158
.word 160
.word 161
.word 162
.word 164
.word 165
.word 166
.word 168
.word 169
.word 170
.word 171
.word 173
.word 174
.word 175
.word 176
.word 177
.word 178
.word 179
.word 180
.word 181
.word 182
.word 183
.word 184
.word 185
.word 186
.word 187
.word 188
.word 189
.word 189
.word 190
.word 191
.word 192
.word 192
.word 193
.word 193
.word 194
.word 195
.word 195
.word 196
.word 196
.word 197
.word 197
.word 197
.word 198
.word 198
.word 198
.word 199
.word 199
.word 199
.word 199
.word 199
.word 199
.word 199
.word 199
.word 200
.word 199
.word 199
.word 199
.word 199
.word 199
.word 199
.word 199
.word 199
.word 198
.word 198
.word 198
.word 197
.word 197
.word 197
.word 196
.word 196
.word 195
.word 195
.word 194
.word 193
.word 193
.word 192
.word 192
.word 191
.word 190
.word 189
.word 189
.word 188
.word 187
.word 186
.word 185
.word 184
.word 183
.word 182
.word 181
.word 180
.word 179
.word 178
.word 177
.word 176
.word 175
.word 174
.word 173
.word 171
.word 170
.word 169
.word 168
.word 166
.word 165
.word 164
.word 162
.word 161
.word 160
.word 158
.word 157
.word 155
.word 154
.word 152
.word 151
.word 149
.word 148
.word 146
.word 145
.word 143
.word 142
.word 140
.word 139
.word 137
.word 135
.word 134
.word 132
.word 130
.word 129
.word 127
.word 125
.word 124
.word 122
.word 120
.word 119
.word 117
.word 115
.word 113
.word 112
.word 110
.word 108
.word 106
.word 105
.word 103
.word 101
.word 99
.word 98
.word 96
.word 94
.word 93
.word 91
.word 89
.word 87
.word 86
.word 84
.word 82
.word 80
.word 79
.word 77
.word 75
.word 74
.word 72
.word 70
.word 69
.word 67
.word 65
.word 64
.word 62
.word 60
.word 59
.word 57
.word 56
.word 54
.word 53
.word 51
.word 49
.word 48
.word 47
.word 45
.word 44
.word 42
.word 41
.word 39
.word 38
.word 37
.word 35
.word 34
.word 33
.word 31
.word 30
.word 29
.word 28
.word 26
.word 25
.word 24
.word 23
.word 22
.word 21
.word 20
.word 19
.word 18
.word 17
.word 16
.word 15
.word 14
.word 13
.word 12
.word 11
.word 10
.word 10
.word 9
.word 8
.word 7
.word 7
.word 6
.word 6
.word 5
.word 4
.word 4
.word 3
.word 3
.word 2
.word 2
.word 2
.word 1
.word 1
.word 1
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 1
.word 1
.word 1
.word 2
.word 2
.word 2
.word 3
.word 3
.word 4
.word 4
.word 5
.word 6
.word 6
.word 7
.word 7
.word 8
.word 9
.word 10
.word 10
.word 11
.word 12
.word 13
.word 14
.word 15
.word 16
.word 17
.word 18
.word 19
.word 20
.word 21
.word 22
.word 23
.word 24
.word 25
.word 26
.word 28
.word 29
.word 30
.word 31
.word 33
.word 34
.word 35
.word 37
.word 38
.word 39
.word 41
.word 42
.word 44
.word 45
.word 47
.word 48
.word 50
.word 51
.word 53
.word 54
.word 56
.word 57
.word 59
.word 60
.word 62
.word 64
.word 65
.word 67
.word 69
.word 70
.word 72
.word 74
.word 75
.word 77
.word 79
.word 80
.word 82
.word 84
.word 86
.word 87
.word 89
.word 91
.word 93
.word 94
.word 96
.word 98
.word 100
.end
.MMREGS
.TEXT
START:
LDP #120H
SACL 0
LOOP: LACC 0
OUT 0,04H
SACL 0
BCND LOOP,LEQ
B START
.END
Result:
Thus the waveforms are generated using DSP processor.
Ex.No:
Date :
IMPLEMENTATION OF CONVOLUTION
AIM:
x (n)=[1 3 1 3]
h (n)=[0 1 2 1]
ESSENTIALS REQUIRED:
PROGRAM:
.mmregs
.text
START:
LDP #02H
lacc #0c100h
mar *,ar0
rpt #3
lar ar6,#8104h
mar *,ar6
lacc #0h
rpt #3h
sacl *+
LACC *+
MAR *,AR2
ZAP
MACD 0C100H,*-
MAR *,AR3
SACL *+
MAR *,AR4
BANZ LOP,*-
H: B H
RESULT:
Thus the linear convolution using DSP processor was calculated and the output is verified.
Ex.No:
Date :
AIM:
To implement a band pass and band reject FIR filter using Blackmann window.
APPARATUS REQUIRED:
PROGRAM:
BAND PASS:
* Filter Order: 52
.mmregs
.text
B START
CTABLE:
.word 024AH
.word 010FH
.word 0FH
.word 0FFECH
.word 0C6H
.word 0220H
.word 0312H
.word 02D3H
.word 012FH
.word 0FEBDH
.word 0FC97H
.word 0FBCBH
.word 0FCB0H
.word 0FE9EH
.word 029H
.word 0FFDCH
.word 0FD11H
.word 0F884H
.word 0F436H
.word 0F2A0H
.word 0F58AH
.word 0FD12H
.word 075FH
.word 01135H
.word 01732H
.word 01732H
.word 01135H
.word 075FH
.word 0FD12H
.word 0F58AH
.word 0F2A0H
.word 0F436H
.word 0F884H
.word 0FD11H
.word 0FFDCH
.word 029H
.word 0FE9EH
.word 0FCB0H
.word 0FBCBH
.word 0FC97H
.word 0FEBDH
.word 012FH
.word 02D3H
.word 0312H
.word 0220H
.word 0C6H
.word 0FFECH
.word 0FH
.word 010FH
.word 024AH
*
* Move the Filter coefficients
* from program memory to data memory
START:
MAR *,AR0
LAR AR0,#0200H
RPT #33H
BLKP CTABLE,*+
SETC CNF
LACC #0
SACL 0
IN 0,06H
MAR *,AR7
IN 0,4
NOP
NOP
NOP
NOP
MAR *,AR1
LAR AR1,#0300H
LACC 0
AND #0FFFH
SUB #800H
SACL *
LAR AR1,#333H
MPY #0
ZAC
RPT #33H
MACD 0FF00H,*-
APAC
LAR AR1,#0300H
LACC *
ADD #800H
SACL *
OUT *,4
LACC #0FFH
SACL 0
OUT 0,05
NOP
B ISR
.end
BAND REJECT:
* Filter Order: 52
.mmregs
.text
B START
CTABLE:
.word 0FEB9H
.word 14EH
.word 0FDA1H
.word 155H
.word 0FE1BH
.word 282H
.word 0FEAFH
.word 2ACH
.word 0FD35H
.word 8DH
.word 0F9D9H
.word 0FE07H
.word 0F7CCH
.word 0FEE2H
.word 0FA2FH
.word 4BAH
.word 1AH
.word 25CH
.word 420H
.word 1008H
.word 89H
.word 0D61H
.word 0F3F2H
.word 0AF9H
.word 0DB7EH
.word 045DFH
.word 045DFH
.word 0DB7EH
.word 0AF9H
.word 0F3F2H
.word 0D61H
.word 89H
.word 1008H
.word 420H
.word 25CH
.word 1AH
.word 4BAH
.word 0FA2FH
.word 0FEE2H
.word 0F7CCH
.word 0FE07H
.word 0F9D9H
.word 8DH
.word 0FD35H
.word 2ACH
.word 0FEAFH
.word 282H
.word 0FE1BH
.word 155H
.word 0FDA1H
.word 14EH
.word 0FEB9H
START:
MAR *,AR0
LAR AR0,#0200H
RPT #33H
BLKP CTABLE,*+
SETC CNF
SACL 0
IN 0,06H
MAR *,AR7
IN 0,4
NOP
NOP
NOP
NOP
MAR *,AR1
LAR AR1,#0300H
LACC 0
AND #0FFFH
SUB #800H
SACL *
LAR AR1,#333H
MPY #0
ZAC
RPT #33H
MACD 0FF00H,*-
APAC
LAR AR1,#0300H
LACC *
ADD #800H
SACL *
OUT *,4
LACC #0FFH
SACL 0
OUT 0,05
NOP
B ISR
.end
Result:
Thus a band pass and band reject FIR filter using Blackmann window is implemented.