Standard Deviation - Signal Filtered

13 views (last 30 days)
HUGO SILVA
HUGO SILVA on 18 Aug 2017
Edited: HUGO SILVA on 6 Sep 2017
Dears,
I am haveing some difficult to find a way to solve the problem using the standard deviation.
I have a signal with noises and some peaks. My goal it was to locate theses peaks , before to do it, i filtered the signal to remove the noises and then I locate the desirable peaks. Untill here it was made it
My issue is that I would like to measure the confiability and the standard deviation of theses peaks found comparing with the signal not filtered
I used the command std, but it does not attend my needs. Does anybody has any suggestion?
since now, I thanks you all.
  2 Comments
MG Poirot
MG Poirot on 18 Aug 2017
So you want to use the findpeaks function to get the peaks, calculate the std of the peaks and compare this to the std of the unfiltered signal? What is the goal/problem exactly? What exactly is wrong with the std function? You can send and exampe signal, code and desired results along with your question.
HUGO SILVA
HUGO SILVA on 4 Sep 2017
Edited: HUGO SILVA on 6 Sep 2017
Firstly, my experiment consists in the validation of measure datas. I am comparing my datas using the Hitran data that is world reference.
I am measuring CO2 concentration using the fiber optics as a senser. I am trying analisy my datas comparing with reference datas. Before it, I need to filter my signal measaured, after detect the peaks (I already did it) and compare the datas with the reference datas.
My goal in this moment is to know if the filtering is being good or not, and I intend to analisy it using the standard deviation.
clc close all clear
%% Division of datas load dado2.mat load offset5.mat ciclo = 13.5; passo = 0.004; CH1=dados2(:,2); CH2=dados2(:,3); REP=length(CH2); t=passo:passo:(REP/1000); Fs=1/(t(2)-t(1));
%% Mean of offsets of each channel M1 = mean(offset5(:,1)); M2 = mean(offset5(:,2));
%% Normalization for i=1:REP x(i)= ((CH2(i)-M2)/(CH1(i)-M1))*100; end i=0;
%% Configuration of Filter ============================================ M=20; %Ordem wc=0.009; % Cut Frequence (Hz) j=[0:M-1]; filtroL = fir1(M,wc,'low');
%% Filtragem do sinal ruidoso no dominio do tempo ================ xf1 = conv(x,filtroL); xf = xf1(:,[60:length(xf1)-60]); % Corte da matriz de dados filtrado para eliminar os dados gerados pela defasagem dos dados.
%% Redimensionamento do tempo devido a convolucao tfilt = (1:length(xf)-M)/Fs;
%% Plotagem do sinal filtrado com o sinal com o ruido figure() plot(tfilt,x(1:length(tfilt))); hold on plot(tfilt,xf(1:length(tfilt))); xlabel('Tempo(s)') ylabel('Amplitude') title('Sinal Filtrado')
%% Contagem de ciclos do vetor xf de 14 segundos
exp1=1; col = fix(length(x)/(Fs*ciclo));
%% Redimensionamento automatica de um vetor de uma sinal filtrado para uma matriz % onde a coluna representa 1 ciclo do motor.
[Lc,Cc] = size(x'); dim = fix(Lc/col); cont=0; k=0;
B = reshape(x(1:fix(Lc/col)*col),[],col);
[Lf,Cf]=size(xf'); dim1=fix(Lf/col); cont1 = 0; Bf = reshape(xf(1:fix(Lf/col)*col),[],col);
%% New time scale after filter d1 = dim/Fs; d2 = dim1/Fs;
tp = (passo:passo:d1); tp1 = (passo:passo:d2);
%% location of peaks [pks1,locs1] = findpeaks(-xf(1:length(tfilt)), tfilt, 'MinPeakHeight',-75,'MinPeakDistance',0.2); [pks2,locs2] = findpeaks(-xf(1:length(tfilt)), tfilt, 'MinPeakHeight',-60,'MinPeakDistance',0.2); [C, ia] = setdiff(locs1, locs2, 'stable'); MidPks = [pks1(ia); locs1(ia)]; figure() plot(tfilt, xf(1:length(tfilt))) hold on plot(MidPks(2,:),-MidPks(1,:), '^r') hold off grid
%% Caracterization of Peaks clear a [Px,Py] = size(MidPks); Picos1=Py/6; Picos2=Py/4; if Picos1 < (col+1) & Picos2 >= (col+1) P1D = MidPks(1,1:6:Py)' P1DI = MidPks(2,1:6:Py)'; P2D = MidPks(1,2:6:Py)' P2DI = MidPks(2,2:6:Py)'; P1S = MidPks(1,5:6:Py)' P1SI = MidPks(2,5:6:Py)'; P2S = MidPks(1,6:6:Py)' P2SI = MidPks(2,6:6:Py)'; end if Picos2 <=(col+1)& Picos1 < (col-2) P1D = MidPks(1,1:4:Py)' P1DI = MidPks(2,1:4:Py)'; P2D = MidPks(1,2:4:Py)' P2DI = MidPks(2,2:4:Py)'; P1S = MidPks(1,3:4:Py)' P1SI = MidPks(2,3:4:Py )'; P2S = MidPks(1,4:4:Py)' P2SI = MidPks(2,4:4:Py)'; end;

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!