evaluate a cubic polynomial in an interval
3 views (last 30 days)
Show older comments
Hi at everybody,
I have to evaluate a cubic polynomial in an interval;
I have a polynomials coefficients vector (C) in the form
v1= ( a1 * x^3 ) + ( b1 * x^2 ) + ( c1*x ) + (d1)
and the interval [i_k , i_(k+1)]
Is there a command to do this?
thanks
2 Comments
Answers (2)
John Petersen
on 20 Nov 2012
If you mean you want to evaluate v1 at x values between the kth and (k+1)th values of x, then define x as the interval of interest, define an array for your coefficients and then use polyval to evaluate the polynomial at the values of x you have specified. You can plot the result to see if it's what you expected.
x = [starting_value:stepsize:ending_value];
c = [a1 b1 c1 d1];
v1 = polyval(c,x);
figure;plot(x,v1)
0 Comments
See Also
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!