0% found this document useful (0 votes)
27 views

Up Sampling and Down Sampling

The document discusses up sampling and down sampling of input sequences. Up sampling increases the sampling rate by inserting zeros between existing samples, which stretches out the sequence. Down sampling decreases the sampling rate by selecting every nth sample, where n is the down sampling factor, which compresses the sequence. The document provides a MATLAB program to demonstrate up sampling and down sampling of an input sequence with a sampling factor of 5. It also provides a program to demonstrate up sampling and down sampling of a sine wave with different sampling rates.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Up Sampling and Down Sampling

The document discusses up sampling and down sampling of input sequences. Up sampling increases the sampling rate by inserting zeros between existing samples, which stretches out the sequence. Down sampling decreases the sampling rate by selecting every nth sample, where n is the down sampling factor, which compresses the sequence. The document provides a MATLAB program to demonstrate up sampling and down sampling of an input sequence with a sampling factor of 5. It also provides a program to demonstrate up sampling and down sampling of a sine wave with different sampling rates.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

UP SAMPLING AND DOWN SAMPLING

input sequence
x(n)

Program:
clear all; x=input('enter the input sequence'); l=input('enter the sampling'); z=zeros(1,(l*length(x))); z([1:l:length(z)])=x; disp(z); subplot(3,1,2); stem(z); xlabel('n'); ylabel('x(n)'); title('up sampling'); y=x([1:l:length(x)]); disp(y); subplot(3,1,3); stem(y); xlabel('n'); ylabel('y(n)'); title('down sampling'); disp(x); subplot(3,1,1); stem(x); xlabel('n'); ylabel('x(n)'); title('input sequence');

1.5

2.5

3 3.5 n up sampling

4.5

5
x(n)

10

15 n down sampling

20

25

1
y(n)

0.5 0

0.2

0.4

0.6

0.8

1 n

1.2

1.4

1.6

1.8

Output:
enter the input sequence [ 1 2 3 4 5] enter the sampling>> 5 Columns 1 through 13 1 0 0 0 0 2 0 0 0 0 3 0 0 Columns 14 through 25 0 0 4 0 0 0 0 5 0 0 0 0 1 1 2 3 4 5

SINE SAMPLING Program:


input sequence 1

clear all; l=input('enter d length of input'); s=input('enter d sampling rate'); f=input('enter d frequency'); t=0:1/f:12; y=sin(t); subplot(3,1,1); stem(t,y); title('input sequence'); t0=0:1/(s*f):12; y0=sin(t0); subplot(3,1,2); stem(t0,y0); title('up sampled sequence'); t1=0:s/f:12; y1=sin(t1); subplot(3,1,3); stem(t1,y1); title('down sampled sequence');

0 -1 1 0 -1 1 0 -1

6 8 up sampled sequence

10

12

4 6 8 down sampled sequence

10

12

10

12

Output:

enter d length of input [ 1 2 3 4 ] enter d sampling rate 2 enter d frequency 2

You might also like