function adamnofool(mxmy,v,nm,fname) % Creates a *.mat file with two vectors X and Y that will be tested % for differences in their means using MATLAB's own TTEST2. % % INPUT: % % mxmy Two means % v One variance % nm Size n (rows, observations), m (columns) samples % fname String with filename % % EXAMPLE: % % % Generate the data % nm=[randi(100) randi(10)]; % adamnofool([2 3],1,nm,'fakedata1') % % Do the test % load fakedata1 % [H,P,CI] = ttest2(X,Y); % b=boxplot(CI); grid on; xlabel('sample'); % ylabel('95% confidence interval for the difference of the means') % title(sprintf('%i pairs of %i samples',nm(2),nm(1))) % % Create independent, normally distributed data sets with equal % variances but different means. Same length vectors, though noting % that TTEST2 will allow for unequal lengths in X and Y. % That's it X=randn(nm)*sqrt(v)+mxmy(1); Y=randn(nm)*sqrt(v)+mxmy(2); % Now save save(fname,'X','Y')