computing the cross spectrum of two-dimensional matrice
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
n vc
le 29 Juin 2015
Modifié(e) : Walter Roberson
le 4 Juil 2015
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 commentaires
Réponse acceptée
Walter Roberson
le 2 Juil 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 commentaires
Walter Roberson
le 3 Juil 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?
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!