信号的有效值(RMS)估计
Posted lyuyangly
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了信号的有效值(RMS)估计相关的知识,希望对你有一定的参考价值。
% Root Mean Square Value
function [retval] = rms1(sig)
N = 20;
for k = 1 : length(sig)/N - 1
sig_sum = sum(sig((k-1)*N+1 : k*N));
squ_sum = sum(sig((k-1)*N+1 : k*N).**2);
retval(k) = sqrt(squ_sum/N);
end
endfunction
% Root Mean Square Value of AC
function [retval] = rms2(sig)
N = 20;
for k = 1 : length(sig)/N - 1
sig_sum = sum(sig((k-1)*N+1 : k*N));
squ_sum = sum((sig((k-1)*N+1 : k*N) .- sig_sum/N).**2);
retval(k) = sqrt(squ_sum/N);
end
endfunction
% Root Mean Square Value of AC
function [retval] = rms3(sig)
N = 20;
for k = 1 : length(sig)/N - 1
sig_sum = sum(sig((k-1)*N+1 : k*N));
squ_sum = sum(sig((k-1)*N+1 : k*N).**2);
retval(k) = sqrt((squ_sum - sig_sum)/N);
end
endfunction
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Fs = 1e5;
N = 1000;
t = [0 : 1/Fs : (N-1)/Fs];
x = 2 * 1.414 * cos(2*pi*25e3*t) .+ 2 * 1.414 * cos(2*pi*10e3*t) + 1.0;
figure;
subplot(2,2,1)
plot(x(1:50));
grid on;
subplot(2,2,2);
plot(rms1(x));
grid on;
subplot(2,2,3);
plot(rms2(x));
grid on;
subplot(2,2,4);
plot(rms3(x));
grid on;
以上是关于信号的有效值(RMS)估计的主要内容,如果未能解决你的问题,请参考以下文章