フィルターのクリア

evaluate a cubic polynomial in an interval

1 回表示 (過去 30 日間)
Max
Max 2012 年 11 月 20 日
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 件のコメント
Matt Fig
Matt Fig 2012 年 11 月 20 日
You don't show vector C. Is C like this:
C = [a1 b1 c1 d1];
or what?
Max
Max 2012 年 11 月 20 日
Sorry, I forgot a step ;) Yes

サインインしてコメントする。

回答 (2 件)

John Petersen
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)

Max
Max 2012 年 11 月 20 日
I try to be more explicit:
I have to calculate the inflection point of a cubic spline.
I have 2 vectors that contains experimental data; - temperature - - > temp = [t1 t2 t3 ... t7 ] - deepness (depth); - - > deep = [d1 d2 d3 ... d7]
with :
pp=spline(deep,temp);
I generate the spline; with :
[x,C,l,k,d]=unmkpp(pp);
I extrapolated the coefficient of spline in the C matrix: ervery rows represents a interpolating polynomial ( f(x) = ax^3 + bx^2 + cx + d);
To identify the inflection point, I calculate (first the first derivatives and then) the second derivative of the spline coefficients ( the polynomial derivatives is f''(x) = 6ax + 2b )
CoefDer2 = [6*C(:,1) 2*C(:,2)];
Cder2 = mkpp(x,CoefDer2);
Then, I impose f''(x)=0 and calculate all polynomials roots
xCder2 = cell2mat(arrayfun(@(X) roots(Cder2(X,:)), (1:size(Cder2,1)),'un',0))';
Now in xCder2 (vector) there are memorized all the x-components of the probable inflection points.
at this point I have to evaluate every polynomial in its interval:
for example, evaluate xCder2(1), in the interval (deep(1), deep(2)) xCder2(2), in the interval (deep(2), deep(3)) etc

カテゴリ

Help Center および File ExchangeSplines についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by