
%Damon Praefke
%Project 5
%25080241

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Plot Z-transform of signal

fs1=1000;													
f=15;															
w=2*pi*f;													
dw=2*pi*3/4;												
t=0:1/fs1:1.5;											

x=sin(w*t)+2*sin((w+dw)*t)+3*cos((w-dw)*t);		
Xz=freqz(x);											

h1=fir1(50,[0.015 0.035],kaiser(51,0.5));		
y1=conv(x,h1);											
Yz=freqz(y1);											


figure(1);													
plot(abs(Yz));											
title('Plot of Z-Transform ');	
xlabel('f');									
ylabel('Yz');									

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Plot Chirp-Z transform

f1=7.5;
f2=17.5;
m1=512;																						
w1=exp(-j*2*pi*(f2-f1)/(m1*fs1));						
a1=exp(j*2*pi*f1/fs1);									

z1=czt(y1,m1,w1,a1);									
fz1=((0:length(z1)-1)'*(f2-f1)/length(z1))+f1;	

figure(2);												
plot(fz1,abs(z1));									
axis([f1 f2 0 4000]);								
title('Plot of Chirp-Z transform');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

fs2=2000;													
ft2=20;														
w2=2*pi*ft2;											
dw2=2*pi*3/4;											
t=0:1/fs2:1.5;												

x2=sin(w2*t)+2*sin((w2+dw2)*t)+3*cos((w2-dw2)*t);	
Xz2=freqz(x2);											

h2=fir1(60,[0.035 0.055],kaiser(61,0.6));		
y2=conv(x2,h2);											
Yz2=freqz(y2);											
	

f2=17.5;
f3=27.5;
m2=1028;																					
w2=exp(-j*2*pi*(f3-f2)/(m2*fs2));						
a2=exp(j*2*pi*f2/fs2);									

z2=czt(y2,m2,w2,a2);										
fz2=((0:length(z2)-1)'*(f3-f2)/length(z2))+f2;

figure(3);												
plot(fz2,abs(z2));									
axis([f2 f3 0 10]);									
title('Plot of Chirp Z transform of Y2');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

fs3=1500;													
ft3=25;												
w3=2*pi*ft3;												
dw=2*pi*3/4;											
t=0:1/fs3:1.5;											

x3=sin(w3*t)+2*sin((w3+dw)*t)+3*cos((w3-dw)*t);	
Xz=freqz(x3);											

h3=fir1(70,[0.055 0.075],kaiser(71,0.7));		
y3=conv(x3,h3);										
Yz=freqz(y3);											
	
f3=27.5;
f4=37.5;
m3=512;																					
w3=exp(-j*2*pi*(f4-f3)/(m3*fs3));					
a3=exp(j*2*pi*f3/fs3);								

z3=czt(y3,m3,w3,a3);									
fz3=((0:length(z3)-1)'*(f4-f3)/length(z3))+f3;	

figure(4);												
plot(fz3,abs(z3));								
axis([f3 f4 0 400]);								
title('Plot of Chirp Z transform of Y3');
