# RF Wireless World

## Home of RF and Wireless Vendors and Resources

One Stop For Your RF and Wireless Need

## Decimation/Down sampling MATLAB source code

This section of MATLAB source code covers decimation or down sampling matlab code. It covers basics of decimation/down sampling.

Decimation refers to removing samples in between the existing vector of values. By doing so sample rate of the signal or vector will decrease hence it is referred as down sampling the signal.

### Setting up exponential vector to be down sampled

%Setting up exponential signal vector to be down sampled
clc;
clear all;
N=input('Enter length of the output sequence:');
M=input('Enter down sampling factor:');
a=input('Enter the value of base of exponent function:');
n=0:N-1;
m=0:N*M-1;
x=a.^m;

### Downsampling the exponential vector

% Generate the downsampled signal
y=x([1:M:length(x)]);
figure,stem(n,x(1:N));xlabel({'Samples in time';'(a)'});ylabel('magnitude');title('Decimator input');
figure,stem(n,y);xlabel({'Samples in time';'(b)'});ylabel('magnitude');title('down sampled output');

### Downsampling using decimate matlab function

% Generate the downsampled signal using decimate function
y=decimate(x,M,'fir');
m=0:N/M-1;
figure,stem(m,y(1:N/M));title('MATLAB decimate function output');xlabel('Time');ylabel('magnitude');

### Input and Output    ### 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