- 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)
- 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)
trimming start end end of time series data in matlab 2015
5 views (last 30 days)
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
0 Comments
Accepted Answer
Rohit Pappu
on 28 Oct 2020
Edited: Rohit Pappu
on 28 Oct 2020
There are two possible sources of errors when the number of frames is reduced -
0 Comments
More Answers (0)
See Also
Categories
Find more on Specifying Target for Graphics Output 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!