How to write a curve-fitting Matlab script

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ย. 2024
  • This tutorial will guide you through writing a Matlab script that fits a curve to a set of data. I use a sine function as an example, but this method can be extended for use in many other functions suh as exponential functions, polynomials, square roots, etc.
    All files, including the scripts written in this video (complete with helpful comments) are available for download at:
    ------------------------------------OUTDATED LINK--------------------------------------
    drive.google.c...
    ------------------------------------NEW LINK------------------------------------------------
    drive.google.c...

ความคิดเห็น • 28

  • @sandeep8585
    @sandeep8585 6 ปีที่แล้ว

    Thanks a lot....Such a beautiful Explanation. !!

  • @papess690
    @papess690 7 ปีที่แล้ว

    Thank you very much! I have't realize it need to import by column!

  • @aliakil1249
    @aliakil1249 7 ปีที่แล้ว

    Thank you Roberto, this was very helpful!

  • @nicolaisirbu5819
    @nicolaisirbu5819 5 ปีที่แล้ว +1

    Hy. Very useful. The problem is that the results are very sensible to the initial guess for the parameters to be estimate. Maybe it's just for my function that i adjust using your scripts as example. What is to be done to get the same results no matter what initial values are adopted?

  • @suntem7
    @suntem7 7 ปีที่แล้ว

    This helped a lot. Thanks

  • @musavincentshabalala4712
    @musavincentshabalala4712 3 ปีที่แล้ว

    Thank you for this tutorial.
    My question is, how to fit an equation to the data gathered during an experiment?

  • @LuthandoMaqondo
    @LuthandoMaqondo 6 ปีที่แล้ว

    Very very helpful

  • @surajbhosale9791
    @surajbhosale9791 5 ปีที่แล้ว

    good job

  • @agnivogosai6764
    @agnivogosai6764 6 ปีที่แล้ว +2

    Can you make a video showing the confidence interval for the curve fit ?

    • @talkohavy
      @talkohavy 5 ปีที่แล้ว +1

      I don't think he knows what you mean.
      It's not like he did chi-squared test or anything.

  • @dariomiric2958
    @dariomiric2958 4 ปีที่แล้ว

    Thanks for the tutorial, it helped :)
    Do you know how can I find the minimum of objective function (ds) after finding optimal parameters?

  • @namitgaur
    @namitgaur 5 ปีที่แล้ว

    I am doing a curve fit to data using fminsearch. Unfortunately the fit does not converge. Can you please suggest alternatives?

  • @JackSparrow-yt3qw
    @JackSparrow-yt3qw 3 ปีที่แล้ว

    I have a non linear curve from a bending test, how may I know which equation would be suitable for data fitting?

  • @Bosco12ful
    @Bosco12ful 6 ปีที่แล้ว

    Hi, I have this eq. df/dt=f(n+5)-f(n)/T, T is the time (data) and f the frequency(data). I want to use the window of 100ms. How can I achieve that with a curve fitting? I need to get df/dt .

  • @3happyD
    @3happyD 6 ปีที่แล้ว

    Hi, I have a polynomial SUM equations, where my goal is to calculate the 'n' value for the polynomial function, and observe 'n' equals to what number gives me a better fitting to my data set. My question is if this is achievable using Matlab?

  • @mateuszsz8720
    @mateuszsz8720 6 ปีที่แล้ว

    Hello Roberto, are you able to show me how to apply it for a circle fitting using least-squares method?

  • @musafir1068
    @musafir1068 6 ปีที่แล้ว +1

    can you again elaborate the values of C1, C2, C3and C4

  • @yarasd2749
    @yarasd2749 6 ปีที่แล้ว

    can you advice me : I have a set of data i want to plot it in points then find the best fit of this data using a function I have, but i dont have a fixed range and this initial guess , because i want to make it with GUI and the user can upload different set of data every time. the fitting equation we have but there is one variable in this function we need to calculate it according to our curve ...is it possible

  • @sattwikaacharya_math.musica
    @sattwikaacharya_math.musica 4 ปีที่แล้ว

    Sir, can you please elaborate this method for a system of ODEs

  • @princekakran8734
    @princekakran8734 5 ปีที่แล้ว

    please explain again how you took the values of C3 & C4

  • @samarjitsingh4166
    @samarjitsingh4166 6 ปีที่แล้ว

    how to fit two functions with same parameters in matlab. Plz help me in this regard

  • @subhadipchakrabortty4192
    @subhadipchakrabortty4192 4 ปีที่แล้ว

    can I fit it by using a double integral equation?

  • @zalasyu
    @zalasyu 6 ปีที่แล้ว +1

    I get this error using you layout for my program:
    Assignment has more non-singleton rhs dimensions than non-singleton subscripts
    Error in fminsearch (line 200)
    fv(:,1) = funfcn(x,varargin{:});
    Error in Lab_Report_3 (line 33)
    C = fminsearch(@ds,[18 0.017 -3.1 18])

  • @krishnachandrasharma8133
    @krishnachandrasharma8133 7 ปีที่แล้ว

    What if the equation itself is in a differential form?

    • @robertoespinozajr.7226
      @robertoespinozajr.7226  7 ปีที่แล้ว

      Hello, do you mind clarifying your question? Are you are looking to fit a curve to data that is the solution to a differential equation? To the extent of my knowledge, you'll have to solve the differential equation in order to attempt to fit anything. Whether or not this equation has a closed form solution is another problem altogether. There are, however, different numerical methods to solving differential equations, and you can plot both your data and the approximate solution on the same plot.
      Let me know if I understood your question correctly so I know how I can help :)

  • @farahfaroha1548
    @farahfaroha1548 6 ปีที่แล้ว

    I couldn't download the files, how can l do it

  • @briankrohnke1569
    @briankrohnke1569 5 ปีที่แล้ว

    Fminsearch has an error

  • @-maroute-myroad7511
    @-maroute-myroad7511 2 ปีที่แล้ว

    please can you help me !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!