Custom fit curve and plotted curve are different, help
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everyone, I'm using the Fitter App to fit some point with a custom equation, the fit is done correctly but when I put the same values for the same parameters in a MATLAB to plot the points with a scatterplot and the fit curve like a plot the fit curve is shifted up or down, and I have to manually adjust the parameters to get a decent looking graph (I'm posting an example)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1715271/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1715276/image.png)
4 Kommentare
Sam Chak
am 14 Jun. 2024
Hi, please show the 6 data points and the selected fitting model. Looks like the slope is very high.
A 5th degree polynomial should perfectly go through all 6 points.
Antworten (1)
Shlok
am 16 Jul. 2024
Hi Armando,
I understand that you are trying to manually fit the curve on a scatterplot using the parameters generated by the Curve Fitter app. But you are unable to replicate the plot because the fit curve is not in the same position as the one displayed in the Curve Fitter app.
For reference, I have used the equation and coordinates provided to calculate the fit curve and obtained the following parameters.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1734713/image.png)
This is happening because the values displayed in the result tab are being copied and used directly as an input to the manual curve plotting code. It is important to note that these values are rounded to 4 decimal places in GUI and, hence, are not accurate enough to replicate the Curve Fitter plot. Even the slightest change in these values can shift the curve by a lot.
To manually plot the graph, we need the parameter values exactly same as the calculated values. You can refer the following steps to achieve the same:
- Export the variables to the workspace from the Curve Fitter app. While exporting, multiple variables will be visible. We just need to save the fit (“fittedmodel”, for example).
- Now, we can manually use the parameter values calculated in the Curve Fitter app (“fittedmodel.d” and “fittedmodel.dr”, for example) in the script.
- For further investigation, we can also view the parameter values in higher decimal places, using “format long”. For example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1734723/image.png)
Check out the following documentation link to know more about the Curve Fitter app:
Hope this helps.
Regards,
Shlok
0 Kommentare
Siehe auch
Kategorien
Mehr zu Fit Postprocessing 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!