Interpolation and decimation implementation

9 views (last 30 days)
I am trying to implement interpolation and decimation without using build in functions for this purpose i follow the following sequence
upsampling->filter (interpolation)
filter->downsample (Decimation)
for interpolation filter i use fir interpolation and for decimation i use window hamming method but the problem is whenever i handle the group delay my symobls are reduced. So what should i do to handle this problem.
My code is written below
clc;
clear all;
close all;
idata=ones(1,100);
nfilt=30;
upfac = 10;
alpha = 0.5;
xr = upsample(idata,upfac);
h1 = intfilt(upfac,2,alpha);
y = filter(h1,1,xr);
delay = mean(grpdelay(h1));
y(1:delay) = [];
[B,A]=fir1(30,1/10);
nfilt = nfilt+1;
itemp = 2*idata(1) - idata((nfilt+1):-1:2);
[itemp,zi]=filter(B,1,itemp); %#ok
dec_filter=filter(B,A,y,zi);
delay = mean(grpdelay(B));
dec_filter(1:delay) = [];
dec=downsample(dec_filter,10);
xx=decimate(y,10,'fir');

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!