How to calculate a polynomial with specified point in MatLab? - polyval -- MatLab

 How to calculate a polynomial with specified point in MatLab? - polyval -- MatLab


How to calculate a polynomial with specified point in MatLab?
[Ans]
polyval

[description]

Evaluate polynomial

<Y> = polyval(<P>,<X>)

It will return the value of a polynomial P evaluated at X.

<P> is a vector of length N+1 whose elements are the coefficients of the
polynomial in descending powers:
Y = P(1)*X^N + P(2)*X^(N-1) + ... + P(N)*X + P(N+1)
P is vector type.

<X> is a given value
double or single or int type.

more details on:


code
clear
clc
c=[1 0];
d=1:1:10;
polyval(c,d)
fprintf("1\n");
%{
output:
1 2 3 4 5 6 7 8 9 10
%}
c=[1 0];
d=1:1:10;
polyval(c,d)
fprintf("2\n");
%{
output:
1 2 3 4 5 6 7 8 9 10
%}

Comments