Monday, January 13, 2014

Differentiate time-series data

Aim: to differentiate time-series data

Aim: to differentiate time-series data

and to check the effects of choosing different time interval

Contents

Initialization

clear all; close all; clc;

differentiate symbolic equation

syms x
f=sin(x);
fd=diff(f);
ezplot(f,[0 2*pi])
hold on,
h=ezplot(fd,[0 2*pi]);
set(h,'Color','g')
ylim([-1 1])
legend('sin(x)', 'deriv of sin(x)')

differentiate discret time-series data

Suppose these are measured data

timeInterval=0.01;
t=0:timeInterval/pi:2*pi;
y=sin(t);
yd=diff(y)./(0.01/pi);
figure(2),plot(t,y,'b.',t(1:end-1),yd,'g.')
legend('sin(x)', 'deriv of sin(x)')

discret data, use larger time interval

Suppose these are measured data

timeIntervalL=0.2;
tL=0:timeIntervalL/pi:2*pi;
yL=sin(tL);
ydL=diff(yL)./(timeIntervalL/pi);
figure(3),plot(tL,yL,'b.',tL(1:end-1),ydL,'g.')
legend('sin(x)', 'deriv of sin(x)')

overlay different simulations

figure(4)
ezplot(fd),hold on
plot(t(1:end-1),yd,'bo');
plot(tL(1:end-1),ydL,'ro');
xlim([0 2*pi])

No comments:

Post a Comment

Any comments?

my-alpine and docker-compose.yml

 ``` version: '1' services:     man:       build: .       image: my-alpine:latest   ```  Dockerfile: ``` FROM alpine:latest ENV PYTH...