You are on page 1of 3

Experiment No.

Aim: To study the effect of down sampling in the frequency domain & perform it susing
‘SCILAB’ software.
Software: - SCILAB
Theory:
In digital signal processing, decimation is the process of reducing the sampling rate of
a signal. The term downsampling usually refers to one step of the process, but sometimes the
terms are used interchangeably. Complementary to upsampling, which increases sampling
rate, decimation is a specific case of sample rate conversion in a multi-rate digital signal
processing system. A system component that performs decimation is called a decimator.

When decimation is performed on a sequence of samples of a signal or other continuous


function, it produces an approximation of the sequence that would have been obtained by
sampling the signal at a lower rate (or density, as in the case of a photograph).
The decimation factor is usually an integer or a rational fraction greater than one. This factor
multiplies the sampling interval or, equivalently, divides the sampling rate. For example,
if compact disc audio at 44,100 samples/second is decimated by a factor of 5/4, the resulting
sample rate is 35,280.

Downsampling by an integer factor:

Decimation by an integer factor, M, can be explained as a 2-step process, with an equivalent


implementation that is more efficient:

1. Reduce high-frequency signal components with a digital lowpass filter.


2. Downsample the filtered signal by M; that is, keep only every Mth sample.

Code for SCILAB:


clc
clear

pi=%pi
f1=50
f2=100
fs=max(f1,f2)*25
D=4*(1/min(f1,f2))

Ts=(1/fs)
t=0:Ts:D
X=3*sin(2*pi*f1.*t)+5*sin(2*pi*f2.*t) /// Original Signal ///

N=length(X)

Xf=abs(fft(X))
Xf1=Xf(1:N/2)

f=0:fs/N:fs/2
fn=f(1:N/2)

L=2
fs1=fs/L

Ts1=(1/fs1)
t1=0:Ts1:D
down_X = X(1:L:N); /// Downsampled Signal by a factor of 2 ///

N1=length(down_X)

Xf_down=abs(fft(down_X))
Xf1_down=Xf_down(1:N1/2)

f_down=0:fs1/N1:fs1/2
fn_down=f_down(1:N1/2)

subplot(3,1,1)
plot(t,X,'bo')
plot(t1,down_X,'ro')
plot2d3(t1,down_X,style=5)
h1=legend(['Original_Signal','Downsampled_Signal'],[5])
xlabel("Time ( t )")
ylabel("Amplitude ( A )")
xtitle("Combined plot of original and downsampled signal ")

subplot(3,1,2)
plot(fn,Xf1)
xlabel(" Frequency ( Hz ) ")
ylabel("Magnitude spectrum")
xtitle("Original signal")

subplot(3,1,3)
plot(fn_down,Xf1_down)
xlabel(" Frequency ( Hz ) ")
ylabel("Magnitude spectrum")
xtitle("Downsampled signal")

Output Window:

Conclusion:

You might also like