MATLAB: Do I receive an error when I run the example code in the SEGMENT function documentation in System Identification Toolbox 6.0.1 (R14)

documentationerrorexampleidentificationonessegmentsystemSystem Identification Toolboxtoolboxwrong

I tried to follow the example in the SEGMENT function documentation at the following location:
<http://www.mathworks.com/access/helpdesk/help/toolbox/ident/segment.shtml>
I typed in the following code in the MATLAB command window, but I received the following error message:
??? Error using ==> ones
Size vector must be a row vector with integer elements.

Best Answer

This bug has been fixed in Release 2008a (R2008a).
The example code at the end of the documentation should read as follows:
y = sin([1:50]/3)';
thm = segment([y,ones(length(y),1)],[0 1 1],0.1);
plot([thm,y])