How to plot time with correlation of two matrix?
Afficher commentaires plus anciens
Hi,
I have two matrices (each of 1000*50), here let's say A and B. The time resolution of both the martices are same (corresponds to the number of rows). I need to calculate the time variation of the correlation of A and B and plot it (i,e, plot(time, correlation)). My code is like below, let's say time is t=1:7 sec;
A=[1 2 3 4;4 6 5 7; 1 8 9 3; 1 2 3 4; 3 2 4 1; 4 3 2 1; 5 6 7 4];
B=[0 1 2 3;3 5 5 7; 2 9 9 3; 2 3 4 4; 5 66 7 2; 8 9 10 11; 15 26 17 14];
R=zeros(size(B,1),1);
for i=1:size(B,1)
R(i)=corrcoef(A(i,:),B(i,:),'alpha',0.05);
end
plot(time,R)
I need to calculate correlation between A(1,:) and B(1,:), then A(2,:) and B(2,:) and so on so that the time remain same (correlation at everytime) and I get correlation as same rows as the time. Can anyone help me. Thank you.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Correlation and Convolution dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!