Convolution MATLAB source code
This section of MATLAB source code covers convolution matlab code. convolution basics including matlab function is covered.
Convolving two signals is equivalent to multiplying the frequency spectrum of the two signals. In convolution, before elements of two vectors are multiplied one is flipped and then shifted in time.
convolution output z[n] = ∑X[k] * Y[k-n]
MATLAB code
clc;
clear all;
x=[1 2 3 4 5];
h=[1 2];
y(1)=x(1)*h(1);
y(2)=x(2)*h(1)+x(1)*h(2);
y(3)=x(3)*h(1)+x(2)*h(2);
y(4)=x(4)*h(1)+x(3)*h(2);
y(5)=x(5)*h(1)+x(4)*h(2);
y(6)=x(5)*h(2);
y %outputs the result of convolution between x and h vectors
len=length(y) % length of result(y length) = length(x)+length(h)-1
MATLAB built-in convolution function 'conv'
y1=conv(x,h) % output as per matlab built in function len1=length(y1) plot(y-y1);title('difference between matlab conv function and our code');
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