0% found this document useful (0 votes)
9 views2 pages

cheby

The document describes a MATLAB script for signal processing that generates and filters signals using Chebyshev filters. It calculates and plots the frequency spectra of an original signal, a combined signal, and a filtered signal. The script demonstrates both low-pass and band-pass filtering techniques on cosine wave signals.

Uploaded by

Well-balanced
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

cheby

The document describes a MATLAB script for signal processing that generates and filters signals using Chebyshev filters. It calculates and plots the frequency spectra of an original signal, a combined signal, and a filtered signal. The script demonstrates both low-pass and band-pass filtering techniques on cosine wave signals.

Uploaded by

Well-balanced
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

fs=6000

T=1/fs
t=0:T:0.1
wp1 = 0.2
ws1 = 0.5
Ap = -20*log10(0.9)
As = -20*log10(0.001)
s = cos(2*pi*500*t)
n = cos(2*pi*1000*t)
d = s+n
[N, Wn] = cheb1ord(wp1, ws1, Ap, As)
[b,a] = cheby1(N,Ap,Wn,'low')
% [b,a] = cheby1(N,Ap,Wn,'high')
x = filter(b,a,d)

f = (0:1:length(x)/2)*6000/length(x)

subplot(3,1,1)
C = 2*abs(fft(s))/length(s)
C(1) = C(1)/2
plot(f, C(1:length(f)))
axis([0 fs/4 0 1])
title('Frequency Spectrum of Original Signal')
xlabel('Frequency (Hz)')
ylabel('Magnitude')

subplot(3,1,2)
D = 2*abs(fft(d))/length(s)
D(1)=D(1)/2
plot(f, D(1:length(f)))
axis([0 fs/4 0 1])
title('Frequency Spectrum of Combined Signal')
xlabel('Frequency (Hz)')
ylabel('Magnitude')

subplot(3,1,3)
X = 2*abs(fft(x))/length(s)
X(1)=X(1)/2
plot(f, X(1:length(f)))
title('Frequency Spectrum of Filtered Signal')
xlabel('Frequency (Hz)')
ylabel('Magnitude')
axis([0 fs/4 0 1])
fs=6000
T=1/fs
t=0:T:0.1
Ap = -20*log10(0.9)
As = -20*log10(0.1)
s = cos(2*pi*500*t)
n = cos(2*pi*1000*t)
d = s+n
[b,a] = cheby1(1,4,[0.1 0.5],'bandpass')
% [b,a] = cheby1(3,5,[0.1 0.5],'stop')
x = filter(b,a,d)

f = (0:1:length(x)/2)*6000/length(x)

subplot(3,1,1)
C = 2*abs(fft(s))/length(s)
C(1) = C(1)/2
plot(f, C(1:length(f)))
axis([0 fs/4 0 1])
title('Frequency Spectrum of Original Signal')
xlabel('Frequency (Hz)')
ylabel('Magnitude')

subplot(3,1,2)
D = 2*abs(fft(d))/length(s)
D(1)=D(1)/2
plot(f, D(1:length(f)))
axis([0 fs/4 0 1])
title('Frequency Spectrum of Combined Signal')
xlabel('Frequency (Hz)')
ylabel('Magnitude')

subplot(3,1,3)
X = 2*abs(fft(x))/length(s)
X(1)=X(1)/2
plot(f, X(1:length(f)))
title('Frequency Spectrum of Filtered Signal')
xlabel('Frequency (Hz)')
ylabel('Magnitude')
axis([0 fs/4 0 1])

You might also like