signal resampling using matlab

assassinood
reconstruct.m

function [yr,t] = reconstruct(ys,n,fs) % [yr,t] = reconstruct(ys,n,fs) % % ys Sampled signal to be reconstructed, sampled at t = nT % n Integer sampling vector corresponding to ys % fs Sampling frequency in Hertz (fs = 1/T) % % yr Reconstructed continuous-time signal % t Time vector corresponding to yr % %Create continuous time vector for the reconstructed signal T = 1/fs; nT = n*T; LnT = length(nT); t = [nT(1):T/100:nT(end)]; Lt = length(t); B = pi*fs; % Generate filter array h[t-nT], i.e., LnT shifted sinc functions. We do it % this way so that we can reconstruct the original signal using the time % vector t. h = zeros(LnT,Lt); for k=1:LnT h(k,:) = ((B*T)/pi) * sin(B*(t-nT(k))) ./ (B*(t-nT(k))); end % The reconstructed signal, created using the reconstruction formula. YS = repmat(ys',1,size(h,2)); yr = sum(YS.*h,1);