-
Notifications
You must be signed in to change notification settings - Fork 7
/
ELTest.m
51 lines (43 loc) · 822 Bytes
/
ELTest.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
clear all
[X,Fs] = audioread('70 alvin.wav');
amax=0.5;
amin=17;
L=length(X);
wp=2*pi*400/Fs;
ws=2*pi*600/Fs;
[n,wp] = ellipord(wp/pi,ws/pi,amax,amin);
[b,a] = ellip(n,amax,amin,wp);
[y,W] = filter(b,a,X);
nVec=1:L;
f=fft(y);
f2=fft(X);
figure(1)
plot(nVec/Fs,X)
figure(2)
plot(nVec/Fs,y)
P2 = abs(f/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
Z = Fs*(0:(L/2))/L;
figure(3)
plot(Z,P1)
xlim([0 1000])
title('Single-Sided Amplitude Spectrum of Y(t)')
xlabel('f (Hz)')
ylabel('|P1(f2)|')
P2 = abs(f2/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
Z = Fs*(0:(L/2))/L;
figure(4)
plot(Z,P1)
xlim([0 1000])
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
ylabel('|P1(f2)|')
figure(5)
plot(nVec/Fs,(X-y))
ylim([-0.1 0.1])
W
%N=X-y;
%sound(N)