Up Down Sampling
Up Down Sampling
x(n)
X(w)
30
0.5
20
0
10
-0.5
-1
0.01
0.02
0.03
0.04
0.05
10
20
30
xD(n)
40
50
60
40
50
60
XD(n)
15
0.5
10
0
5
-0.5
-1
0.01
0.02
0.03
0.04
0.05
10
20
30
xD(n)
XD(n)
15
0.5
10
0
5
-0.5
-1
10
15
20
25
10
15
20
25
%% Decimation
clc
clear all
close all
f=100; %sinusoid frequency
T=1/f;
Fs=1000; %Sampling frequency
Ts=1/Fs; %sampling period
t=0:Ts:5*T; %One cycle
y=sin(2*pi*f*t);
%
figure
subplot(3,2,1)
stem(t,y)
title('x(n)')
Y=abs(fft(y));
subplot(3,2,2)
plot(Y)
grid on
title('X(w)')
for n=2:2:length(y)
y(n)=0;
end
subplot(3,2,3)
stem(t,y)
title('xD(n)')
Y=abs(fft(y));
subplot(3,2,4)
plot(Y)
title('XD(n)')
grid on
%%
for n=1:1:(length(y)/2)
z(n)=y(2*n-1);
end
subplot(3,2,5)
stem(z)
title('xD(n)')
Z=abs(fft(z));
subplot(3,2,6)
plot(Z)
title('XD(n)')
grid on
Wavelet Page 1
Multi-Resolution
Monday, October 08, 2012
3:37 PM
Original
2
1
200
400
600
800
1000
LP
1200
1400
HP
0.1
0.05
0
-0.05
200
400
600
800
-0.1
200
LP-level 2
400
600
800
300
400
150
200
HP-Level 2
0.2
0.1
0
-0.1
100
200
300
400
-0.2
100
LP-level 3
200
HP-Level 3
0.02
0.015
0.01
0.005
-0.005
-0.1
-0.01
-0.15
-0.2
-0.015
50
Wavelet Page 2
100
150
200
-0.02
50
100
UP_DOWN_SAMPLING
Tuesday, October 16, 2012
1:29 PM
20
0.5
15
10
-0.5
-1
10
20
30
40
0
-4
0.5
-0.5
-1
10
20
30
40
0
-4
0.5
-0.5
-1
10
15
20
Wavelet Page 3
0
-4
%% up_down_sampling.m
clc
clear all
close all
x=sin(0:0.4:4*pi);
X=abs(fftshift(fft(x)));
-2
-2
-2
N=length(X);
for n=1:1:N
if ceil(n/2)==floor(n/2)% ie even
xDown(n)=x(n);
else
xDown(n)=0;
end
end
XDown=abs(fftshift(fft(xDown)));
w=linspace(-pi,pi,N)
subplot(321)
stem(x)
subplot(322)
plot(w,X)
subplot(323)
stem(xDown)
subplot(324)
plot(w,XDown)
%%
for n=2:2:N
xD(floor(n/2))=x(n);
end
XD=abs(fftshift(fft(xD)));
w2=linspace(-pi,pi,length(XD));
subplot(325)
stem(xD)
subplot(326)
plot(w2,XD)