Borrar filtros
Borrar filtros

trimming start end end of time series data in matlab 2015

7 visualizaciones (últimos 30 días)
I have a program as below
close all;
clear all;
clc;
%%loading the data
fs=240;%sampling frequency
sl=dlmread('Sepfourtyfivemmsl.dat');
sr=dlmread('Sepfourtyfivemmsr.dat');
%%transforms of left oscillator
z1=hilbert(sl);
instant_amplitude = abs(z1);
instant_phase = unwrap(angle(z1));
instant_freq = diff(instant_phase)/(2*pi)*fs;
%% Transformatons of right oscillator
z2=hilbert(sr);
inst_amplitude = abs(z2);
inst_phase = unwrap(angle(z2));
inst_freq = diff(inst_phase)/(2*pi)*fs;
for i=1:2000
norm_intensitysl(i)=sl(i)/instant_amplitude(i);
norm_intensitysr(i)=sr(i)/inst_amplitude(i);
end
for i=1:1999
sumsl=0;sumsr=0;
sumsl=sumsl+instant_freq(i);
sumsr=sumsr+inst_freq(i);
end
meansl=sumsl/1999;
meansr=sumsr/1999;
mean_rel_freq=meansl-meansr;
%%relative values
rel_phase=abs(instant_phase-inst_phase);
rel_freq=abs(instant_freq-inst_freq);
%%plotting results
%subplot(211)
plot(norm_intensitysl,'g');
title('Normalised intensity');
xlabel('Number of framse');
ylabel('Intensity');
hold on;
plot(norm_intensitysr,'r');
legend('left oscillator','right oscillator');
by running above code I am getting a graph like below
here I want to trim first 200 frames and last 200 frames so at line 20 in above program I modified like
for i=200:1800 and got a graph like below
could you please tell me what mistake I did and how to smooth the data by trimming starting and end time series

Respuesta aceptada

Rohit Pappu
Rohit Pappu el 28 de Oct. de 2020
Editada: Rohit Pappu el 28 de Oct. de 2020
There are two possible sources of errors when the number of frames is reduced -
  1. The for loop used to calculate sumsl and sumsr is supposed to contain 1599 iterations instead of 1999. So it should be for i=201:1799 (Line 26)
  2. The denominator value of meansl and meansr should be 1599 instead of 1999 , since only 1599 values are being used to calulate sumsl and sumsr (Line 31 and Line 32)

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by