How to plot a best fit curve to my data points?

조회 수: 39 (최근 30일)
Nisar Ahmed
Nisar Ahmed 2022년 6월 2일
댓글: Sam Chak 2022년 6월 3일
Hi,
I have attached a data (inverted_qp.mat Inv_qpAVO freq;) and a plot between fre and Inv_qpAVO is shown below in red color.
circled points on left hand side are the issue and I want to a best-fit curves passes through these points just like shown on the right hand side figure (in blue color a solid line).
The best fit curve should start from the fist point to the end point as given a solid blue line. Thanks
  댓글 수: 7
John D'Errico
John D'Errico 2022년 6월 3일
편집: John D'Errico 2022년 6월 3일
@Nisar Ahmed Please stop using a new answer every time you want to make a comment.
Sam Chak
Sam Chak 2022년 6월 3일
@Image Analyst, thanks for the insights into the analysis of the data that provides a basis for understanding the curve fitting. 👍

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

답변 (2개)

Kevin Holly
Kevin Holly 2022년 6월 2일
If you have the Curve Fitting Toolbox, you can use the Curve Fitting app after you import your data into the workspace. Within the app, there are many curve fits you could select from. Here is a video showing the process.
  댓글 수: 1
John D'Errico
John D'Errico 2022년 6월 3일
<Moved to a comment from @Nisar Ahmed
@Kevin Holly I tried all the options Curve Fitting Toolbox have but not got best fit results

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


Nisar Ahmed
Nisar Ahmed 2022년 6월 3일
@Alex Sha thank you for you answer,
I am sorry I did not understand, do you mean, I need to compute
f(x) = p1 + p2.*x + p3*x.^1.5 + p4.*log(x) + p5.*exp(p6.*x)
while using
p1 = -0.137921750658333;
p2 = 4.83156544429652E-5;
p3 = -3.87422699831525E-7;
p4 = 0.000904269701487609;
p5 = 0.138139976684668;
p6 = -0.000327312583052385;
and x = Inv_qpAVO;
I am trying as I wrote above and having this error
Array indices must be positive integers or logical values.
Error in InQP_f (line 29)
f(x) = p1 + p2.*x + p3*x.^1.5 + p4.*log(x) + p5.*exp(p6.*x)
  댓글 수: 1
Torsten
Torsten 2022년 6월 3일
편집: Torsten 2022년 6월 3일
p(1) = -0.137921750658333;
p(2) = 4.83156544429652E-5;
p(3) = -3.87422699831525E-7;
p(4) = 0.000904269701487609;
p(5) = 0.138139976684668;
p(6) = -0.000327312583052385;
f = @(x)p(1) + p(2)*x + p(3)*x.^1.5 + p(4).*log(x) + p(5).*exp(p(6).*x);
plot(x,f(x))

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by