forked from ecotaxa/ecotaxatoolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathf_ZOO_spectrum.m
More file actions
37 lines (33 loc) · 855 Bytes
/
Copy pathf_ZOO_spectrum.m
File metadata and controls
37 lines (33 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% function to compute spectrum from ZOOscan data
% input:
% - smin = minimum size
% - smax= maximum size
% - y = array of size measure
% - k = exponant of the logarithmic binning
% - opt = 1 for abundance spectrum
% - opt = 2 for volume spectra -> in this case array y must be in ESD
% made by Pieter Vandromme on june 2008
% modified by F Lombard january 2016
function [X,Y,Z,X1]=f_ZOO_spectrum(sss,vol,smin,smax,kk,opt)
x(1)=smin;t=1;
while x(t,1)<smax
t=t+1;
x(t,1)=x(1)*kk^(t-1);
end
x1=diff(x);
x=log(x);
% x2=diff(x);
X=(x(1:end-1,1)+x(2:end,1))./2; % choix de la taille nominale de chaque classe
if opt==1
y1(1:size(sss,1),1)=1; %abundance
else
y1=vol; %biovolume
end
n=size(x);
for t=1:n-1
aa=find(((sss>=x(t,1)).*(sss<x(t+1,1)))==1);
Y(t,1)=sum(y1(aa,1));
end
Z=Y;%spectre non normalisé
Y=Y./x1; % normalization
X1=x1;