clear all
close all

load('transient_oscillations.mat')

% generate data example
duration = max(t)
n = duration / dt+1
fmax=1/dt



figure(1)
subplot(3,1,1)
num_windows=30;
num_window_points=n/num_windows
duration_window=duration/num_windows
fs=1/dt;
overlap=num_window_points-1
%window = rectwin(num_window_points);
window = hamming(num_window_points);
[S,F,T,P]=spectrogram(final,window,overlap,num_window_points,fs);
pcolor(T,F,P);
Pmax=max(max(P))
Pmin=min(min(P))
Tmax=max(max(T))
Tmin=min(min(T))
view(0,90);
caxis([0,Pmax]);shading flat;
axis([Tmin,Tmax,0,2.0]);
colorbar();
ylabel('frequency')
xlabel('time [s]')

subplot(3,1,2)
% compute FT
window = gausswin(num_window_points);
[S,F,T,P]=spectrogram(final,window,overlap,num_window_points,fs);
pcolor(T,F,P);
Pmax=max(max(P))
Pmin=min(min(P))
Tmax=max(max(T))
Tmin=min(min(T))
view(0,90);
caxis([0,Pmax]);shading flat;
axis([Tmin,Tmax,0,2.0]);
colorbar();
ylabel('frequency')
xlabel('time [s]')

subplot(3,1,3)
% compute FT
window = rectwin(num_window_points);
[S,F,T,P]=spectrogram(final,window,overlap,num_window_points,fs);
pcolor(T,F,P);
Pmax=max(max(P))
Pmin=min(min(P))
Tmax=max(max(T))
Tmin=min(min(T))
view(0,90);
caxis([0,Pmax]);shading flat;
axis([Tmin,Tmax,0,2.0]);
colorbar();
ylabel('frequency')
xlabel('time [s]')
