function yiq = rgb2ntsc(rgb)
%RGB2NTSC Convert RGB values to NTSC colorspace.
%	YIQ = RGB2NTSC(RGB) converts the N-by-3 RGB values in the
%	matrix RGB to NTSC (TV) colorspace YIQ.  YIQ is N-by-3 and
%	contains the NTSC luminance Y, which contains the gray scale
%	information, and chrominance (I and Q) which contain the hue
%	and saturation information.  Setting the I and Q columns of 
%	YIQ to zero retains only the gray scale information.
%
%	See also NTSC2RGB, RGB2IND, IND2RGB, IND2GRAY.

%	Clay M. Thompson 9-16-92
%	Copyright (c) 1992 by The MathWorks, Inc.
%	$Revision: 1.6 $  $Date: 1993/08/18 03:22:25 $

[m,n] = size(rgb);

if n~=3, error('RGB must have 3 columns.'); end

T = [1.0 0.956 0.621; 1.0 -0.272 -0.647; 1.0 -1.106 1.703];

yiq = rgb/T';
