My curve is not fitting

Hello All, I am trying to fit my experimental data with an analytical equation. I am attaching my data and the code that I used. I am doing some mistake. But I am not able to solve it. Thanks in advance for your help.

 Accepted Answer

Walter Roberson
Walter Roberson on 25 Oct 2017

0 votes

The coefficients that it comes up with are pretty close to the best you can get for that equation. The best coefficients are quite close to a = 774.958449381415 b = 0.000201392498068715, which I determined by sweeping a lot of the search space. The residual is on the order of 3.48E-9. Coefficients in the range of a = 550-ish with b as large as 45 can give a residual on the order of 7E-9 which is really not bad: it just happens that there is a narrow range above 750 that can do better on a relative scale.

7 Comments

@km
@km on 25 Oct 2017
I didn't get it. The fit is way worse as you can see in the picture that I am attaching here.
What are the a and b for that picture?
@km
@km on 25 Oct 2017
a=774 b=0.000201
If you take the a and b value that I gave, and use it to project values using @(a,b)0.0536./(a.*sqrt(1+(2*2*pi*f.*b).^2)) and compare it to the coefficients that you just gave, then you would not be able to see any difference on a graph. The two differ by at most 1E-7, compared to your V values that range from 2.5E-5 to 6.9E-5 .
If you let your code plot the graph, and the use the above function to project values with the a, b you indicate, and "hold on" and plot on top of the existing graph, then the only place you will be able to see any visual difference is at the far left side, where the plot shows up one or two pixel different -- not separate lines, just not exactly the same at that edge.
As far as I can tell, the fits we are talking about as being different or "much better" fall within round-off error of being the same.
@km
@km on 25 Oct 2017
Edited: @km on 25 Oct 2017
Thank you for the answer. But I tried to put a=a = 774.958449381415 b = 0.000201392498068715 . But the curve is not fitting. My data has huge change in lower value of x and then stabilizes for higher value of x. But where as the curve from the value of a and b is more or less decreasing continuously.
If your data values are not to be considered noise, then the conclusion would seem to be that the function you give to fit to is not a function that describes the curve to the degree that you would like.
Given that particular function, your existing code already finds very nearly the best coefficients that can be found for that data.
@km
@km on 10 Nov 2017
You were right that there was a problem in the analytical model. Thanks for the help. Apologies for the late reply as i wanted some strong conclusion before starting a different approach.

Sign in to comment.

More Answers (0)

Categories

Asked:

@km
on 25 Oct 2017

Commented:

@km
on 10 Nov 2017

Community Treasure Hunt

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

Start Hunting!