Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
19 views

Up Down Sampling

The document discusses down sampling and up sampling of signals. It shows a original signal x(n), its Fourier transform X(w), and the down sampled version xD(n) where every other sample is removed and its Fourier transform XD(w). It then discusses decimation where every second sample is kept to create xD(n) and its Fourier transform XD(w).

Uploaded by

Manu Prakash
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Up Down Sampling

The document discusses down sampling and up sampling of signals. It shows a original signal x(n), its Fourier transform X(w), and the down sampled version xD(n) where every other sample is removed and its Fourier transform XD(w). It then discusses decimation where every second sample is kept to create xD(n) and its Fourier transform XD(w).

Uploaded by

Manu Prakash
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Down Sampling

Thursday, September 13, 2012


12:07 PM

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

%% Wavelet Filter Bank


0
clc
-1
clear all
close all
-2
n=0:0.1:40*pi;
0
x1n=cos(0.1*n);
x2n=cos(0.99*n);
2
xn=x1n+x2n;
N=length(n);
1
for k=2:2:N
0
ylp(k/2)=(xn(k-1)+xn(k))/2;
yhp(k/2)=(xn(k-1)-xn(k))/2;
-1
end
subplot(3,2,[1:2])
-2
0
plot(xn)
title('Original')
subplot(3,2,3)
2
plot(ylp)
1
title('LP')
subplot(3,2,4)
0
plot(yhp)
title('HP')
-1
%% Level 2
-2
for k=2:2:N/2
0
ylp2(k/2)=(ylp(k-1)+ylp(k))/2;
yhp2(k/2)=(ylp(k-1)-ylp(k))/2;
end
0.15
subplot(325)
plot(ylp2)
title('LP-level 2')
0.1
subplot(326)
plot(yhp2)
title('HP-Level 2')
%% Wavelet Packet
0.05
for k=2:2:N/4
ylp3(k/2)=(yhp2(k-1)+yhp2(k))/2;
yhp3(k/2)=(yhp2(k-1)-yhp2(k))/2;
end
0
figure
subplot(121)
plot(ylp3)
-0.05
title('LP-level 3')
subplot(122)
plot(yhp3)
title('HP-Level 3')

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)

You might also like