Interpolation/Up sampling MATLAB source code

This section of MATLAB source code covers interpolation or up sampling matlab code. It covers basics of interpolation/up sampling.

Interpolation refers to adding samples in between the existing vector of values. By doing so sample rate of the signal or vector will increase hence it is referred as up sampling the signal.

The best approach is to insert approximate values of two samples for adding the in between sample values. There are various techniques such as nearest, linear,spline,cubic etc.

Setting up exponential vector to be upsampled

clc;
clear all;
n=input('enter length of input sample sequence:');
l=input('enter the value of up-sampling factor:');

m=0:n-1;
a=input('enter the value of base of exponent function:');
x=a.^m;

Upsampling the exponential vector

y=zeros(1,l*length(x));
y([1:l:length(y)])=x;
%figure,plot(x);
%figure,plot(y);
figure,stem(m,x);xlabel({'Time n';'(a)'});ylabel('Amplitude');title('Interpolation input');
figure,stem(m,y(1:length(x)));xlabel({'Time n';'(b)'});ylabel('Amplitude');title('upsampled output');

Upsampling using resample matlab function

xi=x;
yi = resample(xi,l,1);
figure,stem(m,yi(1:length(x)));xlabel({'Time n';'(b)'});ylabel('Amplitude');title('upsampled output using matlab function');

Other MATLAB function for interpolation or upsampling is 'interp1' .

Input and Output

Interpolation matlab code input
interpolation input exponential function
upsampled output
upsampled output matlab function

Useful Links to MATLAB codes

Refer following as well as links mentioned on left side panel for useful MATLAB codes.
OFDM Preamble generation  Time off estimation corr  Freq off estimation corr  channel estimation  11a WLAN channel  PN sequence generation  OFDMA Tx Rx  AES DES  carrier aggregation  CCDF  FIR Filter  IIR Filter  Low Pass FIR  Viterbi decoder  CRC8 CRC32 

RF and Wireless tutorials

WLAN  802.11ac  802.11ad  wimax  Zigbee  z-wave  GSM  LTE  UMTS  Bluetooth  UWB  IoT  satellite  Antenna  RADAR