1
0
This commit is contained in:
Rémi Heredero 2023-10-04 12:05:03 +02:00
parent 68d81d4043
commit 9d4d379e1f
6 changed files with 28 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,28 @@
function show_histogram(histogram,Vmin,Vmax)
% show_histogram((histogram,Vmin,Vmax) plots in a figure
% an histogram computed by the Signal Processing Blockset 'Histogram'
% block and exported to the Matlab Workspace through a 'Signal to
% Workspace' block. The 'Signal to Workspace' block has to be
% configured to output a one-dimensional array.
%
% histogram is the name of the variable containing the histogram
% as a one-dimensional array
% Vmin, Vmax are, respectively, the minimal input value and
% the maximal input value, as specified in the dialog box of the
% 'Histogram' block.
% compatible with Matlab R2012b
if ~isnumeric(histogram)
error('histogram is expected to be an array of numbers !');
end
if ndims(histogram)>2 || (size(histogram,1)~=1 && size(histogram,2)~=1)
error('histogram is expected to be a one-dimensional array !');
end
Nbins=length(histogram);
delta=(Vmax-Vmin)/Nbins;
hx = Vmin+delta/2:delta:Vmax;
hy = histogram;
bar(hx,hy);