Filtering After Unsampling in MATLAB Interpolation
Last Updated :
08 Dec, 2022
Upsampling with filtering gives the interpolated signal. The Upsampling process just adds zero-valued samples to the given input signal. There is no practical significance of zero-valued samples to obtain interpolated signals. Indeed these zero-valued samples should be converted into their approximate values based on previous and future samples present in the input signal. The work of conversion of zero-valued samples to approximate magnitude samples is being done by filtering.
So filtering is an important step to obtain Interpolated signal after Upsampling.
Example:
Matlab
Syntax: y=filtfilt(b,a,x);
fs=input( 'enter sampling frequency' );Â
f=input( 'enter frequency of signal' );Â
L=input( 'enter interpolation factor' );Â
t=0:1/fs:1;Â
x=sin(2*pi*f*t);Â
N=length(x);Â
n=0:N-1;Â
m=0:(N*L)-1;Â
x1=zeros(1,L*N);Â
j=1:L:N*L;Â
x1(j)=x;Â
f1=fir1(34,0.48, 'low' );Â
output=2*filtfilt(f1,1,x1);Â
y=interp(x,L);Â
subplot(2,1,1);Â
stem(n,x);Â
xlabel( 'samples' );Â
ylabel( 'amplitude' );Â
title( 'Input signal' );Â
subplot(2,1,2);Â
stem(m,output);Â
axis ([0 200 -1 1]);Â
xlabel( 'samples' );Â
ylabel( 'amplitude' );Â
title( 'Interpolated signal' );
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...