need help to code this cubic fit
2 ビュー (過去 30 日間)
古いコメントを表示
hello
i need some guidace to code the cubic fit optimization in matlab
i coded it initially like this
clc
clear all
syms X;
f=X.^4+2.*X+4;
d_dx = diff(f, X);
dd_dx = diff(d_dx, X);
i=2;
iter=10;
%xk=0;
xk(1)=0.1;
xk(2)=0.2;
u1=subs(d_dx,X,xk(1))+subs(d_dx,X,xk(2))-3*((subs(f,X,xk(1))-subs(f,X,xk(2)))/xk(1)-xk(2));
u2=sqrt(u1^2-subs(d_dx,X,xk(1))*subs(d_dx,X,xk(2)));
xk(3)=xk(2)-(xk(2)-xk(1))*((subs(d_dx,X,xk(2))+u2-u1)/((subs(d_dx,X,xk(2)))-(subs(d_dx,X,xk(1)))+2*u2));
while i<iter
i=i+1;
u1=subs(d_dx,X,xk(i-1))+subs(d_dx,X,xk(i))-3*((subs(f,X,xk(i-1))-subs(f,X,xk(i)))/xk(i-1)-xk(i));
u2=sqrt(u1^2-subs(d_dx,X,xk(i-1))*subs(d_dx,X,xk(i)));
xk(i+1)=xk(i)-(xk(i)-xk(i-1))*((subs(d_dx,X,xk(i))+u2-u1)/((subs(d_dx,X,xk(i)))-(subs(d_dx,X,xk(i-1)))+2*u2));
%
%
end
xk
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!