43 lines
1.2 KiB
Matlab
43 lines
1.2 KiB
Matlab
function meandiffplot(x, y, md, ds, dq, k, nrows)
|
|
% Plot histogram of data sets and of null hypothesis for differences in mean.
|
|
%
|
|
% meandiffplot(x, y, md, ds, dq, k, rows);
|
|
%
|
|
% Arguments:
|
|
% x: vector with the samples of the x data set.
|
|
% y: vector with the samples of the y data set.
|
|
% md: difference of means of the two data sets.
|
|
% ds: vector containing the differences of the means of the resampled data sets
|
|
% dq: minimum difference of the means considered significant.
|
|
% k: current row for the plot panels.
|
|
% nrows: number of rows of panels in the figure.
|
|
|
|
%% (b) plot histograms:
|
|
subplot(nrows, 2, k*2-1);
|
|
bmin = min([x; y]);
|
|
bmax = max([x; y]);
|
|
bins = bmin:(bmax-bmin)/20.0:bmax;
|
|
[xh, b] = hist(x, bins);
|
|
[yh, b] = hist(y, bins);
|
|
bar(bins, xh, 'facecolor', 'b')
|
|
hold on
|
|
bar(bins, yh, 'facecolor', 'r');
|
|
xlabel('x and y [mV]')
|
|
ylabel('counts')
|
|
hold off
|
|
|
|
%% (f) pdf of the differences:
|
|
[h, b] = hist(ds, 20);
|
|
h = h/sum(h)/(b(2)-b(1)); % normalization
|
|
|
|
%% plot:
|
|
subplot(nrows, 2, k*2)
|
|
bar(b, h, 'facecolor', 'b');
|
|
hold on;
|
|
bar(b(b>=dq), h(b>=dq), 'facecolor', 'r');
|
|
plot([md md], [0 4], 'r', 'linewidth', 2);
|
|
xlabel('Difference of means [mV]');
|
|
ylabel('pdf of H0');
|
|
hold off;
|
|
end
|