evaluate a cubic polynomial in an interval
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
John Petersen
2012-11-20
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!