help with fitlm (least squares fit)

조회 수: 1 (최근 30일)
Douglas Brenner
Douglas Brenner 2018년 12월 18일
답변: Douglas Brenner 2018년 12월 19일
I don't understand how to use fitlm if indeed that's the right function to use.
I want to fit 5 sets of data to the function y = ax^2 + bx + c.
tbl = table(Y,X); yes?
but
mdl = fitlm(tbl,'model') what do I use for model?
thanks.
  댓글 수: 5
Image Analyst
Image Analyst 2018년 12월 19일
Douglas's non-Answer moved here since it's not an answer to the original question:
It seems that polyfit is crashing mathlab.
Image Analyst
Image Analyst 2018년 12월 19일
If MATLAB itself crashed and shut down completely, then call the Mathworks.
If it's just your script that throws an error with red text in the command window, then most likely there is a problem with your m-file. Post your data with the paper clip icon, along with code to read it in and call the polyfit() function.
I'm attaching my polyfit demo - perhaps you can adapt it.

댓글을 달려면 로그인하십시오.

채택된 답변

Douglas Brenner
Douglas Brenner 2018년 12월 19일
Your demo crashed it as well.

추가 답변 (2개)

Douglas Brenner
Douglas Brenner 2018년 12월 19일
X = [1,2,3,4,5]
Y = [1,5,6,4,2]
yFit = polyfit(X,Y, 2)
Matlab itself crashed.

Douglas Brenner
Douglas Brenner 2018년 12월 19일
I could try a Gaussian fit. That would work for me. Do you have an example for that?
Thanks.

카테고리

Help CenterFile Exchange에서 Resampling Techniques에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by