0% found this document useful (0 votes)
224 views

FAQ Auto Correlation Matlab Code - Cross Correlation Matlab Code

The document provides code samples for auto correlation and cross correlation in MATLAB without and with the inbuilt xcorr function. It explains correlation, sets up input parameters, provides the code to implement correlation without and with xcorr, and displays the output plots.

Uploaded by

anon_374567901
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
224 views

FAQ Auto Correlation Matlab Code - Cross Correlation Matlab Code

The document provides code samples for auto correlation and cross correlation in MATLAB without and with the inbuilt xcorr function. It explains correlation, sets up input parameters, provides the code to implement correlation without and with xcorr, and displays the output plots.

Uploaded by

anon_374567901
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

9/8/2019 Auto correlation matlab code | Cross correlation matlab code

RF Wireless World
HOME ARTICLES TUTORIALS APP.NOTES VENDORS SOURCE

TERMINOLOGY ACADEMIC T&M CALCULATORS NEWS GENERAL

BOOKS DOWNLOADS CONTACT SITEMAP

Home of RF and Wireless Vendors and


Resources
One Stop For Your RF and Wireless Need

Auto correlation matlab code | RF WIRELESS


Cross correlation matlab code TUTORIALS

{KEYWORD:Solar
5G Energy
NR | ZigbeeNews}
|

z-wave | Bluetooth |

GSM | UMTS | LTE |


Find out about Big Developments
WLAN | 802.11ac |
in Solar Energy -Nikkei Business-
IoT | RADAR |
techon.nikkeibp.co.jp/
satellite | Waveguide |

This page covers Auto correlation matlab code and Cross correlation
matlab code with and without using matlab inbuilt xcorr function.

Correlation determines how much two signals or vectors are similar or


different in phase and magnitude. There are two types auto correlation
and cross correlation. correlation is maximum when two signals are
similar. correlation is equivalent to multiplying the complex conjugate of
frequency spectrum of one signal by the frequency spectrum of the
other.

In auto correlation same signal is correlated to itself or with shifted


version of it. In cross correlation two different time series signals are

https://www.rfwireless-world.com/source-code/MATLAB/correlation-matlab-code.html 1/5
9/8/2019 Auto correlation matlab code | Cross correlation matlab code

correlated. The example below is for cross correlation. If one set both in1
and in2 as same vectors ( or append zeros initially in one) then it
becomes auto correlation.

correlation output z[n] = ∑X[k] * Y[n+k]

Setting up input parameters


in1=[0 1 2 3 4 5 6 7 8 9];
in2=[9 11 12 13 4 5 16 17 18 19];

Cross correlation matlab code


without using inbuilt function (xcorr)
Following matlab script is for cross correlation without using inbuilt
function such as xcorr.

if length(in1)>length(in2)
pad = length(in1)-length(in2);
in2 = [in2 zeros(1,pad)];
elseif length(in1)<length(in2)
pad = length(in2)-length(in1);
in1 = [in1 zeros(1,pad)];
end
out_len = length(in1);
out = zeros(1,out_len); MATLAB SOURCE
CODES
tmp = in2;
for k = 1:out_len
out(k) = in1*tmp'; Scrambler descrambler
tmp = [0 tmp(1:end-1)];
end Interleaver deinterleaver
Data Modulation
figure;plot(out);title('Our code CORRELATION OUTPUT'); % output 16point IFFT
plot as per RF Wireless world design of corr function
[m,n]=max(out) % max value in the correlation and its index correlation
convolution
Cross correlation matlab code using
Interpolation
xcorr
Edge Detection
Following matlab script is for cross correlation matlab code using 'xcorr'
OFDM Preamble
function.
generation

y=xcorr(in1,in2); % matlab built in function Freq off estimation corr


len=length(y);
index=len/2; channel estimation
z=y(index:1:end); %extacting one side of the result
figure;plot(z);title('MATLAB xcorr function OUTPUT'); % output plot as 11a WLAN channel
https://www.rfwireless-world.com/source-code/MATLAB/correlation-matlab-code.html 2/5
9/8/2019 Auto correlation matlab code | Cross correlation matlab code
per matlab function
[m1,n1]=max(z) % max value in the correlation and its index Rician channel
Rayleigh channel
OUTPUT Plots of Cross correlation in SC-FDMA
MATLAB PN sequence
generation
AM FM PM modulation

SPONSORED SEARCHES

code generator app

source code analysis

3 phase ac

rf antenna design

auto binary signals

{KEYWORD:Solar Energy News}

Find out about Big Developments


in Solar Energy -Nikkei Business-
techon.nikkeibp.co.jp/

Useful Links to MATLAB codes

https://www.rfwireless-world.com/source-code/MATLAB/correlation-matlab-code.html 3/5
9/8/2019 Auto correlation matlab code | Cross correlation matlab code

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

SPONSORED SEARCHES

function generator 5g mobile

5g wireless rf antenna

RF and Wireless tutorials


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

SPONSORED SEARCHES

function generator 1 phase ac generator

5g nr 5g wifi

Share this page

Translate this page


Select Language
Powered by Translate

ARTICLES T & M section TERMINOLOGIES Tutorials


Jobs & Careers VENDORS IoT Online calculators source
codes APP. NOTES T & M World Website

HOME VENDORS T&M BOOKS

ARTICLES SOURCE CALCULATORS DOWNLOADS

TUTORIALS TERMINOLOGY NEWS CONTACT

APP.NOTES ACADEMIC GENERAL SITEMAP

https://www.rfwireless-world.com/source-code/MATLAB/correlation-matlab-code.html 4/5
9/8/2019 Auto correlation matlab code | Cross correlation matlab code

©RF Wireless World 2012, RF & Wireless Vendors and Resources, Free HTML5 Templates

https://www.rfwireless-world.com/source-code/MATLAB/correlation-matlab-code.html 5/5

You might also like