my xnew isno being displayed and how would i calculate coefficient of determination and the standard error of estimate?
1 回表示 (過去 30 日間)
古いコメントを表示
v = 10:10:80;
F = [25 70 380 550 610 830 1220 1450];
x = v(:); y = F(:);
fssr = @(a) sum((y-a(1)*sinh(a(2)*x)));
[a, ssrr] = fminsearch(fssr,[1 1])
plot(x,y,'md'); hold on; grid on;
fplot(@(x) amin(1)+x^amin(2), [0 90])
legend('data','nonlinear fit')
sr = fmin; % same as: sr = sum((y-amin(1)-x.^amin(2)).^2)or sr = fssr(amin)
RR = 1-sr/sum((y-mean(y)).^2);
syx = sqrt(sr/(length(y)-length(amin)));
xnew = 5; ynew = amin(1)+xnew^amin(2);
0 件のコメント
回答 (1 件)
Star Strider
2015 年 4 月 13 日
I can’t run your code. Your ‘amin’ variable is missing.
If you want to fit ‘y’ to sinh (shifted and scaled), I would add two parameters to get a better fit, and square the difference in your ‘fssr’ function to produce a sum-of-squares cost function:
ssinh = @(a) a(1)*sinh(a(2)*x+a(3))+a(4);
fssr = @(a) sum((y-ssinh(a)).^2);
[a, ssrr] = fminsearch(fssr,[1 1 1 1])
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!