Finding a trendline from a scatter plot

133 visualizzazioni (ultimi 30 giorni)
Benjamin
Benjamin il 9 Dic 2019
Risposto: ME il 9 Dic 2019
Hello
Dear All
I need to find a trendline for a scatter plot(s) in Matlab. Unfortunately, my scatter plot(s) does not show a nice trend, or relationship between between my X's and Y. I want to know if Matlab is able to give me the best possible trendline that can be fit for that scatter plot or at least I try to fit different types of curves. Excel is able to fit a trendline (Liner, Logarithmic, Polynomial, and etc) having any scatter plot, but it seems Matlab cannot do that--at least using polyfit(X,Y,n) having n=1,2,...
attached is one of my scatter plots picture.
Thank you

Risposta accettata

ME
ME il 9 Dic 2019
MATLAB can do this if you make your scatter plot and then in the figure window go to "Tools -> Basic Fitting". That will then allow you to draw a bunch of different data fits onto your diagram, output the residuals, output the formulae, etc.
I'm sure there is probably a way to call this all programatically but I don't know of it.
I know there are also fitting tools in some of the MATLAB licensed toolboxes, but I don't currently have access to any of those so I can't really be much help on those.
Perhaps somebody else might be able to help with the gaps here!

Più risposte (0)

Categorie

Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by