fitting with piecewiseLine
Afficher commentaires plus anciens
I cannnot fitting.
function f1 = piecewiseLine(x,a,b,c)
f1 = zeros(size(x))
if ( b.*x <= 1) & (c.*(100-x)<=1)
f1 = a.*((1-(x.*b)/2+(x.*b).^2./4- 5.*(x.*b).^3/48+7.*(x.*b).^4./192) ./2+1./sqrt((x.*b)+1)./2)+ a.*((1-((100-x).*c)/2+((100-x).*c).^2./4-5.*( (100-x).*c).^3/48+7.*( (100-x).*c).^4./192) ./2+1./sqrt(((100-x).*c)+1)./2)
elseif ( b.*x <= 1) & (c.* (100-x)>1)
f1 = a.*((1-(x.*b)/2+(x.*b).^2./4- 5.*(x.*b).^3/48+7.*(x.*b).^4./192) ./2+1./sqrt((x.*b)+1)./2)+ a.*((sqrt(2./3.14159./( (100-x).*c)).*(1-1./8./( (100-x).*c)-3./128./( (100-x).*c).^2-15./1024./ ((100-x).*c).^3))./2+1./sqrt(((100-x).*c)+1)./2
elseif ( b.*x > 1) & (c.* (100-x)<=1)
f1 = a.*((sqrt(2./3.14159./(x.*b)).*(1-1./8./(x.*b)- 3./128./(x.*b).^2-15./1024./ (x.*b).^3))./2+1./sqrt((x.*b)+1)./2) + a.*((1-((100-x).*c)/2+((100-x).*c).^2./4- 5.*( (100-x).*c).^3/48+7.*( (100-x).*c).^4./192) ./2+1./sqrt(((100-x).*c)+1)./2)
else
f1 = a.*((sqrt(2./3.14159./(x.*b)).*(1-1./8./(x.*b)- 3./128./(x.*b).^2-15./1024./ (x.*b).^3))./2+1./sqrt((x.*b)+1)./2) ++ a.*((sqrt(2./3.14159./( (100-x).*c)).*(1-1./8./( (100-x).*c)-3./128./( (100-x).*c).^2-15./1024./ ((100-x).*c).^3))./2+1./sqrt(((100-x).*c)+1)./2)
end
end
x =[ ..
]
y =[ ..
]
ft = fittype(' piecewiseLine(x,a,b,c)' )
f = fit( x, y, ft, 'StartPoint', [0.001 0.0001 0.01] )
figure
plot(f, x, y )
error message :
エラー: fit>iFit (行 348)
複素数値がモデル関数で計算されました。近似を続けることはできません。
係数の上限と下限を使用するか、範囲を狭めてみてください。
エラー: fit (行 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
Réponses (0)
Catégories
En savoir plus sur 線形回帰と非線形回帰 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!