Uploaded by MANAS DAGA

ece303

advertisement
CA3
NAME: Manas Daga
REG NO: 11903567
ROLL NO: A10
Section/Group: 1905/G-1
Q1.
Design a low-pass digital Butterworth filter on A4 sheet using Bilinear
Transformation method for satisfying the following constraints:
Passband: 0 – X Hz Stopband: 2.5 – 4 kHz Passband Ripple: Y dB
Stopband attenuation: 40 dB Sampling frequency: 10 kHz *Also write
the MATLAB program for the designed filter and match the calculated
order with the simulation result. Attach the screenshots of the
developed code along with the magnitude and phase response images
of the simulation. Mention title in each simulated MATLAB Figure as
“Title_Your Registration Number”.
clc
% design of butterworth filter
%given specifications
ap=4; % gain in passband not in db
as=40;
f1=2000;
f2=4000;
fs=10000;
t=1;
wp=2*pi* (f1/fs);
ws=2*pi* (f2/fs);
ap1=10 ^(-ap/20); % Converting cm db co unitless.
as1=10 ^(-as/20); % Converting form db to unitless. determination of analog filter edge
frequencies
ohml=(2/t)* (tan (wp/2));
as1=10 ^(-as/20);% Converting form db to unitless. determination of analog filter edge
frequencies
ohm1= (2/t)* (tan (wp/2));
ohm2=(2/t) *(tan (ws/2));
o= ohm2/ohml
N=1/2* log10 (((1/(as1)^2-1)/(1/(ap1) ^2-1)))/log10 (ohm2/ohm1);
N=ceil (N)% calculation of filter order N
ohmc=ohml/(((1/(ap1^2))-1))^(1/(2*N))
ohmcl=fs* ohmc %unnormalised frequency
[n, wn] =buttord (wp/pi, ws/pi, ap1, as1);
[b, a]=butter (N, ohmcl, 'low', 's');
Hs =tf (b, a);
[bl, al]=bilinear (b, a, 1/t);
Hz=tf (bl, al, t);
[h, w]=freqz (b, a);
subplot(2, 1, 1);plot (w/pi, 20 *log10 (abs (h) ));
xlabel ('Normalised frequency');
ylabel ('gain in db');
title ('11903567');
subplot (2, 1, 2); plot (w/pi, angle (h));
xlabel('Normalised frequency');
Q2. Design a Chebyshev Type-1 digital low-pass filter on A4 sheet to
satisfy the following constraints: X dB ripple in passband 0 ≤ ω ≤ 0.35π
Y dB attenuation in stopband 0.65π ≤ ω ≤ π Use Bilinear
Transformation assuming T = 1 sec. *Also write the MATLAB program
for the designed filter and match the calculated order with the
simulation result. Attach the screenshots of the developed code along
with the magnitude and phase response images of the simulation.
Mention title in each simulated MATLAB Figure as “Title_Your
Registration Number”.
clc
ap=3; as=30; wp=0.35*pi;
ws=0.65*pi; t=1;
[n, wn] = cheby1 (wp/pi, ws/pi, as, ap);
ap=10^ (-ap/20);
as=10^(-as/20);
E=sqrt((1/(ap^2))-1);
ohml=(2/t) *(tan (wp/2));
ohm2=(2/t) *(tan (ws/2));
x2=((1/as^2)-1);
a= acosh (sqrt(x2/E));
b= acosh (ohm2/ohm1);
N=ceil(a/b);
wc=((ohml)/(E^(1/N) ));
[b,a]=cheby1 (N, ap, wp);
[h, w]=freqz (b, a);
Hs =tf (b, a);
[bl, al]= bilinear (b, a, 1/t);
Hs=tf (bl, al, t);
subplot (2,1,1);
plot (w/pi,20*log10 (abs (h) ));
xlabel('Normalized frequency');
ylable('gaiin in db');
title('manas daga');
subplot (2,1,2);
plot (w/pi, angle (h));
xlabel ('Normalized frequency'); ylabel('Gain in dB');
title('manas daga');
Q3. Design a digital low-pass Butterworth filter on A4 sheet to satisfy
the following constraints: X dB ripple in passband 0 ≤ ω ≤ 0.4π Y dB
attenuation in stopband 0.6π ≤ ω ≤ π Use Impulse Invariant
Transformation assuming T = 1 sec. *Also write the MATLAB program
for the designed filter and match the calculated order with the
simulation result. Attach the screenshots of the developed code along
with the magnitude and phase response images of the simulation.
Mention title in each simulated MATLAB Figure as “Title_Your
Registration Number”.
clc
% design of butterworth filter
%given specifications
ap=3; % gain in passband not in db
as=30;
f1=0.0178;
f2=0.0095;
t=1;
wp=2*pi* (f1/fs);
ws=2*pi* (f2/fs);
ap1=10 ^(-ap/20); % Converting cm db co unitless.
as1=10 ^(-as/20); % Converting form db to unitless. determination of analog filter edge
frequencies
ohml=(2/t)* (tan (wp/2));
as1=10 ^(-as/20);% Converting form db to unitless. determination of analog filter edge
frequencies
ohm1= (2/t)* (tan (wp/2));
ohm2=(2/t) *(tan (ws/2));
o= ohm2/ohml
N=1/2* log10 (((1/(as1)^2-1)/(1/(ap1) ^2-1)))/log10 (ohm2/ohm1);
N=ceil (N)% calculation of filter order N
ohmc=ohml/(((1/(ap1^2))-1))^(1/(2*N))
ohmcl=fs* ohmc %unnormalised frequency
[n, wn] =buttord (wp/pi, ws/pi, ap1, as1);
[b, a]=butter (N, ohmcl, 'low', 's');
Hs =tf (b, a);
[bl, al]=bilinear (b, a, 1/t);
Hz=tf (bl, al, t);
[h, w]=freqz (b, a);
subplot(2, 1, 1);plot (w/pi, 20 *log10 (abs (h) ));
xlabel ('Normalised frequency');
ylabel ('gain in db');
title ('11903567');
subplot (2, 1, 2); plot (w/pi, angle (h));
xlabel('Normalised frequency');
Q4.
Download the colored image from the internet and load in MATLAB
and do the following operations in MATLAB: a) Convert the image
from RGB to Gray scale. b) Rotate the image at an angle of 45 degree
and 60 degrees. c) Give title to your graph along with your name and
label the axes in MATLAB.
Q5.
Write a program for importing and viewing an ECG file to the
MATLAB. a) Plot the signal. b) Give title to your graph as your name
and label the axes in MATLAB. c) How can we detect abnormalities in
the ECG signal.
Ytttj
mmmmm
The abnormal value of the heart beat does not lie between the ranges of 60 to
100 beats/ minutes. Slower rate than 60 beats/min represents a lower heart rate
and it is called as bradycardia. The higher rate of the heart beat than 100 beats/
min is a fast heart rate and it is called as tachycardia. If the cycle space is not even
then it indicates an arrhythmia. Arrhythmia is indicated by verifying the cycles.
Also, if the P-R interval is greater than 0.2 seconds, then it is suggested as
blockage of the AV node. The heart valves are not diagnosed by ECG, it is
diagnosed using other techniques like angiography and echocardiography which
provide information not in the ECG. ECG is segmented horizontally and P-wave is
obtained and nominated at the baseline. Now the QRS complex becomes the
combination of depolarization of the atria and depolarization of the ventricles and
both occur simultaneously. T-waves reflect the rhythmic electrical depolarization
and repolarization of the myocardium associated with the contractions of the
atria and ventricles. This ECG is used clinically in diagnosing various abnormalities
and conditions associated with the heart. From this it is clear that the duration
and the morphology of the QRS complex help to diagnose the cardiac
arrhythmias, abnormalities of the heart and other disease states.
Q6.
Plot the following signals in MATLAB giving title to your graph along
with your name. (a) Cosine wave and Cosine wave with phase shift (b)
Square wave (c) Sinewave plus Noise (d) Gaussian signal (e)
Exponential decay
A) Cosine wave and Cosine wave with phase shift:
clc
clear all
close all
a = linspace (0,2 *pi)
b = cos (pi/4*a);
plot (a,b);
hold on
c= cos(pi/4 a+pi/7):
plot (a, c);
x=label (‘time');
y=label (‘amplitude');
title('manas daga- Coswave and Coswave phase angle');
(b) Square wave
clc
clear all
close all
X = linspace (-pi, 2*pi, 30);
Y = 7* square (2*X);
plot (X/pi, Y);
xlabel=('time');
ylabel=('amplitude');
title=('manas daga Square Wave');
(c) Sinewave plus Noise
clc
clear all
close all
X=0:0.009:3* pi;
A=sin (X);
B=rand (1, length (X));
C=X+B;
plot (C, A);
xlabel (‘time');
ylabel (‘amplitude’);
title('manas daga Sine Wave Plus Noice');
d) Gaussian signal
clc
clear all
close all
gauss (x, a, b, c) a*exp(-(((x-b).^2)/(2*c.^2))); =
x =-5:0.05:5;
a =3;
b=0;
C = 3;
y = gauss (x, a, b, c);
plot (x, y);
xlabel('time');
ylabel (‘amplitude');
title(‘manas daga Gaussian Pulse');
e) Exponential decay
clc
clear all
close all
A = 5;
B 4;
C= 1:
D = 7:
T = linspace (C, D, 30);
X = exp(-A*T);
Y exp(-B*T);
plot (T, X)
hold o
plot (T, Y)
hold off
xlabel('time');
ylabel('amplitude');
title('manas daga Exponential Decay');
Download