Finding a trendline from a scatter plot

조회 수: 107 (최근 30일)
Benjamin
Benjamin 2019년 12월 9일
답변: ME 2019년 12월 9일
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

채택된 답변

ME
ME 2019년 12월 9일
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!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by