문제

I am trying to calculate the rms of some 2D matices, but am unsure if my approach is correct:

Rrms = sqrt( sum(sum((Z1 - mean(mean(Z1))).^2 )) /(wk*wl) )

(where Z1 is a matrix with size wk * wl)

Is this correct, and if not, what should I use?

도움이 되었습니까?

해결책

According to Root Mean Square definition it's just square root of sum of squared values. In terms of Matlab code it will be.

R = sqrt(sum(sum(Z.^2))/prod(size(Z)))

Another way is to use rms function from signal processing toolbox.

다른 팁

I'm not sure if this request is obsolete. However, try

Rrms = rms(Z1(:))

In any case, the (:)-operator helps!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top