Get x-coordinate from the Minimum of a Fit
4 views (last 30 days)
Show older comments
Hello Guys. I need to get the x-Coordnate of my Fit! I use the Function:
[xData, yData] = prepareCurveData( L, B );
% Set up fittype and options.
ft = fittype( 'poly2' );
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, 'Normalize', 'on' );
% Plot fit with data.
figure, hold on;
title('KonvexeHuelle-Information','FontSize',14)
h = plot( fitresult, xData, yData );
legend( h, 'KonvexeHuelle', 'Fit Polynom 2', 'Location', 'NorthEast' );
% Label axes
xlabel('Z-Position[mm]','FontSize',20)
ylabel('a.u','FontSize',20)
grid on
xvec=[L]; [a,BildnummerKonvHFit]=min(feval(fitresult, xvec));
BildnummerKonvHFit=Abstand+BildnummerKonvHFit*0.1
The problem is the Line
xvec=[L]; [a,BildnummerKonvHFit]=min(feval(fitresult, xvec));
BildnummerKonvHFit=Abstand+BildnummerKonvHFit*0.1
gives me only the Minimum of my normal Function. It seems that the data behind the "," are ignored. I just get a 7 oder 8. Not a 7.43 for Example.
How can i get the x-Coordinate from the Minimum of the Fit? Whould be great if you can help me!
regards Johannes
0 Comments
Answers (0)
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!