Professional Documents
Culture Documents
DSP 7
DSP 7
DSP 7
Status Done
Course 📸 DSP
Priority LOW
function beq=a2dR(d,n)
%BEQ =A2DR(D,N) generates the decimal equivalent of beq binary
%representation
%magnitude part obtained by rounding
m=1;
d1=abs(d);
while fix(d1) >0
d1=abs(d)/(10^m);
m=m+1;
end
beq=0;d1 =d1+2^(-n-1);
for k = 1:n
beq =fix(d1*2)/(2^k )+beq;
d1 = (d1*2)-fix(d1*2);
end
beq = sign(d ).*beq.*10^(m-1);
clc;
clear all;
close all;
%PART A
%to design low pass filter
b=fir1(50,0.65,'low');
display(b);
%to generate pole zero diagram fir - only zeroes, no poles
figure(1);
zplane(b,1);
figure(2);
freqz(b,1,512);
% to truncation : 4=4 bits , we can change, take less than 16
bq =a2dR(b,4);
display(bq);
%generate pole zero diagram for bq
figure(3);
zplane(bq,1);
figure(4);
freqz(bq,1,512);
exp 7 1
1. A2DR Function
The following function is used to convert analog signals to digital.
beq= used for generating decimal equivalent of beq binary response. (for each bit
this function goes on).
6. sign(d) .* beq .* 10^(m - 1) : This expression combines the sign of the original
number, the binary representation, and the scaling factor. It ensures that the binary
representation is correctly scaled and retains the sign of the original number.
exp 7 2
51 coefficents (0:50), freq= 0.65, low pass
Pole zero:
Plotting the given signal in poles and zeros.
exp 7 3