필터 지우기
필터 지우기

Do I need to use repmat to plot the RMS at every point in a signal?

조회 수: 1 (최근 30일)
Win
Win 2014년 2월 18일
댓글: Win 2014년 2월 18일
Can you please tell me how to plot the RMS at every point in the signal. I think I might need to use the repmat function to do it but I'm not sure.
clear all;
Array=csvread('Pencilbreak-63dB.csv');
col1 = Array(:, 1);
col2 = Array(:, 2);
plot(col1, col2)
end
  댓글 수: 7
dpb
dpb 2014년 2월 18일
The file is of little help/interest...as we're telling you, you'll have to choose a sampling window based on the response time of your system you need.
There are several (actually a veritable plethora) of submissions on File Exchange--do a search for "moving rms".
Win
Win 2014년 2월 18일
Thanks for your reply. I'm sorry about the duplicate thread. I just wanted to phrase the question in a better way. Thanks for the help.

댓글을 달려면 로그인하십시오.

답변 (1개)

Chad Greene
Chad Greene 2014년 2월 18일
The rms of a single point is not terribly interesting. There are many ways to do what you're trying to do, but you could take a "moving rms", which would be the rms of a small segment of the signal. To center a 101-point rms of your signal (below call it signal ) about point n, you could do
signalrms = NaN(size(signal)); % preallocates the array
for n = 51:length(signal)-51
signalrms(n) = rms(signal(n-50:n+50));
end
  댓글 수: 2
Win
Win 2014년 2월 18일
Thanks for your code but I don't know how to apply it in my case as my signal is in the form of 2 columns of data. This is the code I have so far to read and plot the data from the csv file:
clear all;
Array=csvread('Pencilbreak-63dB.csv');
col1 = Array(:, 1);
col2 = Array(:, 2);
plot(col1, col2)
end
Chad Greene
Chad Greene 2014년 2월 18일
Yes, we can assume column 1 represents time and column 2 is your signal. In the code above, indices of each value are given by n. That's about as much as I can tell you without actually doing your homework for you.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by