Bonjour, j'ai un problème avec un code histo de stixbox sous matlab que je n'arrive à faire marcher.J'ai télécharger le code sur le net, et aussi il y a des variables que je comprends pas. Comme exemple e qui est le code.Je sollicite de l'aide pour la compréhension du code et le problème qui fait que ça marche pas.Merci d'avance
function binwidth = histo(x,N,odd,scale,sym)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%HISTO    Plot a histogram
%
%         histo(X)
%         histo(X,M,odd,scale)
%
%         Data is X, approximate number of bins is M, and odd
%         should be 0 or 1 for placement of bins. Least significant 
%         digit of bin width will always be 1, 2 or 5. Last argument 
%	  should be one for scaling in order to have the area 1 under
%	  the histogram instead of area n.
 
%       Anders Holtsberg, 14-12-94
%       Copyright (c) Anders Holtsberg
 
if nargin < 2, N = []; end
if nargin < 3, odd = []; end
if nargin < 4, scale = []; end
if nargin < 5,sym='b'; end 
if isempty(N)
   N = ceil(4*sqrt(sqrt(length(x))));
end
if isempty(odd)
   odd = 0;
end
if isempty(scale)
   scale = 0;
end
mn = min(x);
mx = max(x);
d = (mx - mn)/N*2;
e = floor(log(d)/log(10));
m = floor(d/10^e);
if m > 5
   m = 5;
elseif m > 2
   m = 2;
end
d = m * 10^e;
mn = (floor(mn/d)-1)*d - odd*d/2;
mx = (ceil(mx/d)+1)*d + odd*d/2;
limits = mn:d:mx;
f = zeros(1,length(limits)-1);
for i = 1:length(limits)-1
   f(i) = sum(x>=limits(i) & x<limits(i+1));
end
xx = [limits; limits; limits];
xx = xx(:);
xx = xx(2:length(xx)-1);
yy = [f*0; f; f];
yy = [yy(:); 0];
if scale, yy = yy/length(x)/d; end
    plot(xx,yy,sym)
if nargout > 0
  h=f;
  edge=limits;
end