%%
clear all;

load DivExtOr.dat;
t=DivExtOr(:,1); % age in myr
ag=DivExtOr(:,2); % Number of All Genera
wr=DivExtOr(:,3); % Number of Well-Resolved Genera
e=DivExtOr(:,4); % Origination extinction %
o=DivExtOr(:,5); % Origination intensity %

figure(1);
subplot(4,1,1); plot(t,ag); title('all genera');
subplot(4,1,2); plot(t,wr); title('well-resolved genera');
subplot(4,1,3); plot(t,e); title('extinction %');
subplot(4,1,4); plot(t,o); title('origination %');

% 
%% detrend
ag=detrend(ag);
wr=detrend(wr);
e=detrend(e);
o=detrend(o);

figure(2);
subplot(4,1,1); plot(t,ag); title('all genera');
subplot(4,1,2); plot(t,wr); title('well-resolved genera');
subplot(4,1,3); plot(t,e); title('extinction %');
subplot(4,1,4); plot(t,o); title('origination %');

