# Simple x-y curve fitting from data set.

조회 수: 4 (최근 30일)
Tom 2013년 2월 24일
I'm struggling to find a simple example of simple curve fitting in MATLAB.
I just want to do a best-fit curve for the following data:
x = [1 1.5 2 2.5 3 10e10]
y = [19.74 14.26 12.34 11.45 10.97 9.87];
Please could someone show me how to do it?
##### 댓글 수: 2없음 표시없음 숨기기
Wayne King 2013년 2월 24일
do you really have an x vector where the final value jumps from 3 to 10^10?
Tom 2013년 2월 24일
Well it's supposed to be infinity but yes.

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

### 채택된 답변

the cyclist 2013년 2월 24일
편집: the cyclist 2013년 2월 24일
If you type
doc polyfit
in the MATLAB command window, you will see a simple example (and of course the syntax of the command).
EDIT:
I didn't really pay attention to the, uh, unusual shape of your data. polyfit() does simple polynomial fitting, so it's not right for you.
There's not really going to be a fit for a point "at infinity". You should probably add some detail about what you are trying to really accomplish here.
##### 댓글 수: 3이전 댓글 1개 표시이전 댓글 1개 숨기기
Jurgen 2013년 2월 24일
By definition that line is the best fit , as it goes through every point? If you wan't more restrictions you need to decide on what form your fit must have, even if you don't know the "true" underlying function.
the cyclist 2013년 2월 24일
Tom, that example starts off with erf() simply to create the sample of data which will be fit later.
As Jurgen says, you need to decide what form you want.

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

### 카테고리

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

### Community Treasure Hunt

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

Start Hunting!

Translated by