trimming start end end of time series data in matlab 2015
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!