I have data in the csv format that I'm plotting it using the lines of code below. The data has 2 columns and 1048576 rows. I have uploaded part of it below- the actual files being too large. Can you please tell me how to plot the RMS of the data?
if true clear all Array=csvread('Pencilbreak-63dB.csv'); col1 = Array(:, 1); col2 = Array(:, 2); plot(col1, col2) end

 Réponse acceptée

Dishant Arora
Dishant Arora le 18 Fév 2014

0 votes

RMS = (sum(col2.^2)/length(col2))^0.5;

9 commentaires

Win
Win le 18 Fév 2014
I need to plot the RMS signal of the waveform, not just find the RMS value.
RMS is scalar not a vector, anyways you can plot it for whole length of signal:
plot(1:length(col1),RMS)
Win
Win le 18 Fév 2014
Do you mean I should add the following 2 lines of code?
" clear all
Array=csvread('Pencilbreak-23dB.csv');
col1 = Array(:, 1);
col2 = Array(:, 2);
RMS = (sum(col2.^2)/length(col2))^0.5;
plot(1:length(col1),RMS) " ?
MATLAB is not giving me the graph I expect to get?
Dishant Arora
Dishant Arora le 18 Fév 2014
what do you want??
Win
Win le 18 Fév 2014
An illustration of what I need:
Dishant Arora
Dishant Arora le 18 Fév 2014
you aredoing windowing there,taking smallportions of the data and then calculating RMS.
Dishant Arora
Dishant Arora le 18 Fév 2014
Modifié(e) : Dishant Arora le 18 Fév 2014
you can do something like:
clear all; Array=csvread('Pencilbreak-63dB.csv');
col1 = Array(:, 1); col2 = Array(:, 2); plot(col1, col2)
window = 20;
for i=1:window:length(col1)
RMS(i:i+window-1) = (sum(col2(i:i+window-1).^2)/10)^0.5;
end
plot(col1,RMS)
Dishant Arora
Dishant Arora le 18 Fév 2014
window size may vary asper the need
Win
Win le 18 Fév 2014
ok, thanks a lot.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by