# Design a notch filter

matlab code num=[1 zeros(1,9) -1]; %z^10 -1 z1= roots (num); angz=angle(z1)*180/pi; rho=.95; den=[1 zeros(1,9) -rho^10]; %z^10-rho^10 p1=roots(den); angp=angle(p1)*180/pi; theta=linspace(0,2*pi,1000); uc=exp(j*theta); plot(real(uc), imag(uc)); plot(real(uc), imag(uc),real(p1), imag(p1),’*’, real(z1), imag(z1),’o’); w=linspace(0,pi,1000); H=freqz(num,den,w); %frequency response mag=abs(H); ph=angle(H)*180/pi; % plot(w,mag); % frequency repsonce of the filter freq=(w*250/pi); max_val=max(mag); norm=(1/max_val)*mag; %normalised values figure(3); plot(freq,norm); T=1/500; t=0:T/500:T % figure(4); % plot(t); sig=10*sin(2*pi*20*t); noise=.3*sin(2*pi*50*t) +.2*sin(2*pi*100*t) +.1*sin(2*pi*150*t) +.1*sin(2*pi*200*t) +.1*sin(2*pi*250*t) ; figure(4); plot(t,sig+noise); y=sig+noise; yy=fft(y); yya=abs(yy); yya=yya(1:500); freq1=linspace(0,250,500); y1=sig+noise; yyb1=fft(y1); yyb=abs(yyb1); yyb=yyb(1:500); figure(5); plot(freq1,yyb); yf=filter(num,den,yyb); % figure((6)); % plot(t,yf); yyf=fft(yf); yyf=(yyf(1:500)); yyf=abs(yyf); t=(1:500); figure(6); plot(t,yyf); X1=filter(MULT1,den,y1); XFF=fft(X1); XA=abs(XFF); XO=XA(1:500); t=1:500; figure(7); plot(t,XO);