필터 지우기
필터 지우기

Calculate inflection point of spline

조회 수: 2 (최근 30일)
Max
Max 2012년 11월 19일
Hi, I have to calculate the inflection point of a cubic spline.
I have 2 vectors that contains experimental data; - temperature - - > temp = [t1 t2 t3 ... tn ] - deepness (depth); - - > deep 0 [d1 d2 d3 ... dn]
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 )
Cder=bsxfun(@times,C(:,1:end-1), 3:-1:1);
Cder2 = bsxfun(@times,Cder(:,1:end-1), 2:-1:1);
or
CoefDer2 = [6*C(:,1) 2*C(:,2)];
Cder2 = mkpp(x,CoefDer2);
However, 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 there are memorized all the x-components of the inflection points.
Then, I calculate the y-component of the with:
yCder2 = cellfun(@(xtipo,ytipo) polyval(xtipo,ytipo), num2cell(C,2), num2cell(xCder2));
Finally, I join the two-component-vector in single points with
Points=num2cell([xCder2, yCder2],2); [p1,p2,p3,p4,p5,p6,p7]=deal(Points{:});
Is my execution correct? Thanks a lot
M

답변 (1개)

Max
Max 2012년 11월 20일
Any opinion?

카테고리

Help CenterFile Exchange에서 Splines에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by