Matlab

correlation between two signals and sequences

CORRELATION:

The concept correlation can be defined as similarities of two waveforms. It may determine if signal x1(t) waveform contain an amount c2x2(t) of that particular waveform x2(t) in the interval of (t1, t2). It is a measure of the degree to which two sequences are similar.Correlation is of two types cross correlation and autocorrelation.

Cross correlation:

Cross-correlation between two signals indicates what proportion one signal is said to the time-delayed version of another signal.

clc;

close all;

clear all;

% two input sequences

x=input(‘enter input sequence’);

h=input(‘enter the impulse sequence’);

subplot(2,2,1);

stem(x);

xlabel(‘n’);

ylabel(‘x(n)’);

title(‘input sequence’);

subplot(2,2,2);

stem(h);

xlabel(‘n’);

ylabel(‘h(n)’);

title(‘impulse sequence’);

% cross correlation between two sequences

y=xcorr(x,h);

subplot(2,2,3);

stem(y);

xlabel(‘n’);

ylabel(‘y(n)’);

title(‘ cross correlation between two sequences ‘);

Autocorrelation:

The auto correlation function is a special form of cross correlation function.

clc;

close all;

clear all;

% two input sequences

x=input(‘enter input sequence’);

h=input(‘enter the impulse sequence’);

subplot(2,2,1);

stem(x);

xlabel(‘n’);

ylabel(‘x(n)’);

title(‘input sequence’);

subplot(2,2,2);

stem(h);

xlabel(‘n’);

ylabel(‘h(n)’);

title(‘impulse sequence’);

% auto correlation of input sequence

z=xcorr(x,x);

subplot(2,2,4);

stem(z);

xlabel(‘n’);

ylabel(‘z(n)’);

title(‘auto correlation of input sequence’);

crosscorrelation between two signals

clc;

close all;

clear all;

% cross correlation between two signals

% generating two input signals

t=0:0.2:10;

x1=3*exp(-2*t);

h1=exp(t);

figure;

subplot(2,2,1);

plot(t,x1);

xlabel(‘t’);

ylabel(‘x1(t)’);

title(‘input signal’);

subplot(2,2,2);

plot(t,h1);

xlabel(‘t’);

ylabel(‘h1(t)’);

title(‘impulse signal’);

% cross correlation

subplot(2,2,3);

z1=xcorr(x1,h1);

plot(z1);

xlabel(‘t’);

ylabel(‘z1(t)’);

title(‘cross correlation ‘);

% auto correlation

subplot(2,2,4);

z2=xcorr(x1,x1);

plot(z2);

xlabel(‘t’);

ylabel(‘z2(t)’);

title(‘auto correlation ‘);

Rajeshwari Chiluveru

Rajeshwari (M.Tech) is the Technical Education Director at WebVidyalayam. She focuses on translating high-level systems engineering into accessible technology courses.

Share
Published by
Rajeshwari Chiluveru

Recent Posts

Samsung TV Red Light Blinking? 4 Fixes (2026 Power Logic Hub)

User Problem Scenario: The Red Light "Panic" You press the power button on your Samsung…

2 weeks ago

Samsung TV Not Connecting to WiFi: 2026 Easy Fix Guide

Introduction: I Know the Feeling "We’ve all been there. You sit down to watch your…

2 weeks ago

Samsung TV Restarting During Diagnosis? Fix the Reboot Loop Fast

User Problem Scenario: The "Diagnosis Loop" Paradox Imagine you notice your apps are slow. You…

2 weeks ago

Samsung TV Optimize Now Not Working? (2026 Fix: Greyed Out, Stuck or Not Responding)

🎓 Technical Module: Memory Maintenance Logic Module: WV-OS-307 Verified 2026 👨‍🏫 Instructor: Vangari Divya (M.Tech)…

2 weeks ago

Samsung Smart Hub Test Failed? (2026 Fix: DNS, ISP Block & Authentication Error)

 Introduction: The Setup Paradox "There is a specific moment of frustration for every Samsung Smart…

3 weeks ago

Samsung TV Picture Test Not Working? 4 Technical Recovery Fixes

Introduction: Lab Diary & Experience "When your Samsung TV screen begins to flicker or show…

3 weeks ago