Minimum and Maximum value of fitted curve
26 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Zack Trahem
am 20 Mär. 2022
Beantwortet: Nipun
am 20 Dez. 2022
I am trying to find the minimum and maximum value of fitted curve. I will use the min and max point in another calculation. I used 'poly4' fit and its gives 4th order polynomial function. I tried polyder but couldnt go further. How can find the maximum and minimum point of fitted curve?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 20 Mär. 2022
Bearbeitet: Image Analyst
am 20 Mär. 2022
So I assume you have the red, fitted curve since you plotted it (if not see first 2 lines below), so why can't you just simply do
coefficients = polyfit(x, y, 4); % fit to a 4th order polynomial.
yfit = polyval(coefficients, x); % Evaluate the fit at the same x values.
minFit = min(yFit); % Find min of fitted curve in the range we have fit it over.
maxFit = max(yFit); % Find max of fitted curve in the range we have fit it over.
If you want, you can use an x in polyval() that has finer resolution than the original x. Something like
numSamplePoints = 2000; % However many you need to get the resolution you want.
xFit = linspace(min(x), max(x), numSamplePoints);
yfit = polyval(coefficients, xFit); % Evaluate the fit at the same x values.
Of course you could get the exact value of the apex just by computing the derivative from the coefficients vector.
2 Kommentare
Weitere Antworten (2)
Nipun
am 20 Dez. 2022
Use the curve of best fit to find the maximum and minimum flow rates separately during the inflow and the outflow
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!