How to do correlation from data with series
1 次查看(过去 30 天)
显示 更早的评论
Hi i have to make corelation to check the dependance of variable c from series 1 or 2. Can I split t vector into two one t1 and t2 make 2 seperet correlations of t1 to c1 and t2 to c2?
t=[21,22 ,323,43,231,53,23,12,53,12]
c=[23,12 ,223,333,21,63,24,23,763,14]
p={"1","1","1","1","1","2","2","2","2","2"}
1 个评论
采纳的回答
Adam Danz
2021-1-14
编辑:Adam Danz
2021-1-15
You can use xcorr and indexing.
t=[21,22 ,323,43,231,53,23,12,53,12];
c=[23,12 ,223,333,21,63,24,23,763,14];
p=["1","1","1","1","1","2","2","2","2","2"]; % <-- String array with square brackets
[groupID, groups] = findgroups(p)
xcorr(c(groupID==1), t(groupID==1))
xcorr(c(groupID==2), t(groupID==2))
or use splitapply
splitapply(@(x1,x2){xcorr(x1,x2)}, c, t, groupID)
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!