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!