MATLAB Answers

coherence plot and correlation plot,time domain to frequency domain

14 views (last 30 days)
Sana Ejaz
Sana Ejaz on 1 Jul 2019
Answered: Navya Seelam on 17 Jul 2019
Hi ,
I have attached a sample data.I want to create a correlation as well as coherence plot for the attached time series data.
In order to understand the difference between time and frequency domain of time series I need to plot both correlation and coherence of same time series so that I can spot and understand the difference.Since I am new to the frequency domain concept I don't know how to measure coherence and how to make coherence plot.My understanding is that in order to measure coherence I would need to convert the time series that is in time domain to frequency domain.But I dont know how to do that.
Would highly appreciate if someone can help.

Accepted Answer

Navya Seelam
Navya Seelam on 17 Jul 2019
Hi,
If you have the Signal Processing Toolbox, use the function "mscohere" to plot coherence.
n = 0:599;
x = cos(pi/4*n)+randn(size(n));
y = 1/2*sin(pi/4*n)+randn(size(n));
[Cxy,W] = mscohere(x,y);
Plot(W,Cxy)
You can obtain the correlation using the function "xcorr"
C=xcorr(x,y);
For more details check the MATLAB documentation of the above functions

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!