From: Jerome on 21 May 2010 14:56 Thanks in advance for your help. I am looking at the script of the kstest2() function of the statistics toolbox (by using "type kstest2") as I want to understand how it is working. Line 126 has the following: binEdges = [-inf ; sort([x1;x2]) ; inf]; I tried executing this line of code on the command line and get a vertical concatenation error. Can anyone describe how this line works and what it is trying to do? I am guessing it is creating a matrix of four rows with the first and last row holding the value of inf. However, it seems like I would have to do the following infVec = zeros(1,length(x1))+inf; binEdges = [-infVec ; sort([x1;x2]) ; infVec]; but this assumes that x1 and x2 are of the same length. Basically I am wondering if I am interpreting this line correctly since I am not able to emulate it outside of the script, which makes me wonder why the kstest2() script works at all. Cheers, Jerome
From: Steven Lord on 21 May 2010 15:02 "Jerome " <natty_brew(a)yahoo.com> wrote in message news:ht6l04$het$1(a)fred.mathworks.com... > Thanks in advance for your help. > > I am looking at the script of the kstest2() function of the statistics > toolbox (by using "type kstest2") as I want to understand how it is > working. Line 126 has the following: > > binEdges = [-inf ; sort([x1;x2]) ; inf]; > > I tried executing this line of code on the command line and get a vertical > concatenation error. Can anyone describe how this line works and what it > is trying to do? I am guessing it is creating a matrix of four rows with > the first and last row holding the value of inf. It's creating a (2+numel(x1)+numel(x2))-by-1 column vector -- note earlier in the code that x1 is columnized by "x1 = x1(:);" and similarly for x2. *snip* -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Walter Roberson on 21 May 2010 15:10 Jerome wrote: > I am looking at the script of the kstest2() function of the statistics > toolbox (by using "type kstest2") as I want to understand how it is > working. Line 126 has the following: > > binEdges = [-inf ; sort([x1;x2]) ; inf]; > > I tried executing this line of code on the command line and get a > vertical concatenation error. Can anyone describe how this line works > and what it is trying to do? I am guessing it is creating a matrix of > four rows with the first and last row holding the value of inf. Probably not. x1 and x2 are probably column vectors. [x1;x2] would then be a larger column vector, sort() of that would be a column vector in ascending order, and then -inf is tacked on to the top and inf is tacked on to the bottom. The -inf and inf have to do with histc not normally counting values above or below the edges you give; in infinities force the counting of all values (because no value can be smaller than -inf or larger than +inf).
From: Jerome on 21 May 2010 15:25 "Steven Lord" <slord(a)mathworks.com> wrote in message <ht6lbc$b48$1(a)fred.mathworks.com>... > > "Jerome " <natty_brew(a)yahoo.com> wrote in message > news:ht6l04$het$1(a)fred.mathworks.com... > > Thanks in advance for your help. > > > > I am looking at the script of the kstest2() function of the statistics > > toolbox (by using "type kstest2") as I want to understand how it is > > working. Line 126 has the following: > > > > binEdges = [-inf ; sort([x1;x2]) ; inf]; > > > > I tried executing this line of code on the command line and get a vertical > > concatenation error. Can anyone describe how this line works and what it > > is trying to do? I am guessing it is creating a matrix of four rows with > > the first and last row holding the value of inf. > > It's creating a (2+numel(x1)+numel(x2))-by-1 column vector -- note earlier > in the code that x1 is columnized by "x1 = x1(:);" and similarly for x2. > > *snip* > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com > Thank you both for your quick response. I wasn't understanding that x1 = x1(:) made a column vector. That explains it. Cheers, Jerome
|
Pages: 1 Prev: DWT watermarking embedding and extraction Next: Trying To Understand The kstest2() Script |