You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: chebpolyval.m
    path of file: ./repos/chebfun
    
    the code of the file until where you have to start completion: function y = chebpolyval(p, x)
%CHEBPOLYVAL   Evaluate Chebyshev polynomial. 
%   Y = CHEBPOLYVAL(P, X), when P is a column vector of length N+1 whose
%   elements are the Chebyshev coefficients of a polynomial, is the value of the
%   polynomial evaluated at X, i.e.,
%
%     Y = P(1)*T_N(X) + P(2)*T_{N-1}(X) + ... + P(N)*T_1(X) + P(N+1)*I
%
%   If X is a matrix or vector, the polynomial is evaluated at all points in X.
%   If X is a CHEBFUN it should be scalar-valued, i.e., not a quasimatrix.
%
%   If P is an (N+1) x M matrix, then CHEBPOLYVAL interprets each of the columns
%   of P as coefficients of a degree N polynomial and evaluates the M Chebyshev
%   expansions
%  
%     Y_m = P(1,m)*T_N(X) + ... + P(N,m)*T_1(X) + P(N+1,m)*T_0(X), 1 <= m <= M,
%  
%   returning the results as columns of a matrix Y = [Y_1 ... Y_M].
%
%   See CHEBPOLYVALM for evaluation in a matrix sense.
% 
% See also POLYVAL, CHEBPOLYVALM.


    
function y = chebpolyval(p, x)
%CHEBPOLYVAL   Evaluate Chebyshev polynomial. 
%   Y = CHEBPOLYVAL(P, X), when P is a column vector of length N+1 whose
%   elements are the Chebyshev coefficients of a polynomial, is the value of the
%   polynomial evaluated at X, i.e.,
%
%     Y = P(1)*T_N(X) + P(2)*T_{N-1}(X) + ... + P(N)*T_1(X) + P(N+1)*I
%
%   If X is a matrix or vector, the polynomial is evaluated at all points in X.
%   If X is a CHEBFUN it should be scalar-valued, i.e., not a quasimatrix.
%
%   If P is an (N+1) x M matrix, then CHEBPOLYVAL interprets each of the columns
%   of P as coefficients of a degree N polynomial and evaluates the M Chebyshev
%   expansions
%  
%     Y_m = P(1,m)*T_N(X) + ... + P(N,m)*T_1(X) + P(N+1,m)*T_0(X), 1 <= m <= M,
%  
%   returning the results as columns of a matrix Y = [Y_1 ... Y_M].
%
%   See CHEBPOLYVALM for evaluation in a matrix sense.
% 
% See also POLYVAL, CHEBPOLYVALM.

% Copyright 2017 by The University of Oxford and The Chebfun Developers. 
% See http://www.chebfun.org/ for Chebfun information.

if ( ~isnumeric(p) )
    error('CHEBFUN:chebpolyval:firstArg', ...
        'First input argument must be a vector or a matrix.');
end