computing the cross spectrum of two-dimensional matrice
3 views (last 30 days)
Show older comments
Hi there
I got stuck with the matlab syntax trying to compute the cross spectrum of two-dimensional matrices.
I suppose that what I need is something like
[Pxy,F]=cpsd(x,y,[],[],[],dt);
where x and y are 100x100 matrices. Obviously the above syntax doesn't work, but that works for my vectors.
I've browsed the web and couldn’t find anything really.
Is there anyone out there kind enough to show me the correct syntax? Or is there any other command that does the job instead of cpsd?
I'm working with MATLAB Version 7.11.0.584 (R2010b)
Tips are highly welcomed, regards
nvc
0 Comments
Accepted Answer
Walter Roberson
on 2 Jul 2015
<<The input signals may be either vectors or two-dimensional matrices. If both are vectors, they must have the same length. If both are matrices, they must have the same size, and cpsd operates columnwise: Pxy(:,n) = cpsd(x(:,n),y(:,n))>>
3 Comments
Walter Roberson
on 3 Jul 2015
for c=1:c and for l=1:l might work in practice but they are going to confuse the heck out of people reading them. You should avoid using a loop control variable named the same thing as one of the bounds of the loop. For example,
[numrow numcol] = size(s1);
for c = 1:numcol
[Psp1(:,c),F]= cpsd(s1(:,c),p1(:,c),[],[],[],dt);
end
for l = 1:numrow
[Psp2(l,:),F]= cpsd(s1(l,:),p1(l,:),[],[],[],dt);
end
For the other quadrants: does the 'twosided' parameter help with that?
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!