Professional Documents
Culture Documents
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.
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: