cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Hi everyone, I would like to fit my data with the function describe on the file

ptc-4749353
1-Visitor

Hi everyone, I would like to fit my data with the function describe on the file

I could not. I have try with genfit but no way. could someone helpme please.

Thank you

8 REPLIES 8
Werner_E
25-Diamond I
(To:ptc-4749353)

Your function f has no free parameters to fit/play around with! What do you think that fitting a function to a set of data points is doing? You may benefit from reading the help about genfit and looking at the quicksheets.

BTW, are you sure about your function f? See below what it looks like simplified with the values you provided.

One other thing - get rid of the index i in timescan. The way you wrote it you create a vector with 203 elements, all af which are zero and only timescan[202 consists of a vector which contains the data you are interested in. Just delete all i (three times) in your sheet.

fit.png

I am sure about the function and I have even used the simplify form, but I am not able to fit data using this function. Even if I delete i, I can't fit the data.

I often used genfit but now I am blocked.Here is the file with the simplify form.

Werner_E
25-Diamond I
(To:ptc-4749353)

Patrick Seumo schrieb:

I am sure about the function and I have even used the simplify form, but I am not able to fit data using this function. Even if I delete i, I can't fit the data.

I often used genfit but now I am blocked.Here is the file with the simplify form.

As already written in another post in this thread, deleting i helps uncluttering the mess with vector time but has nothing to do with genfit.

In your sheet you ask why our symbolically simplified euqations look different. Thats because you used simplify (which is a good idea anyway) and I did not. The simplification has again nothing to do with genfit, it simply helped to show that your function had not a single parameter to adjust and therefore genfit had to fail.

It seems you do good in being sure about your function, as it produces a not so bad fit.

Nevertheless I could image that a least square fit using three or four Gaussians would do a better job. If I remember right Richard had shown and explained to you in a thread a few months ago how to do.

But now, to help you remember about how to use genfit find attached the solution using genfit.

fit2.png

the problem with four gaussian is that I can not publish with. it is not scientific. Please I would like to know if the file you have sent you have obtain the fitting using my function.

if yes, thank you very much. I don't know why the file look gray color.

Werner_E
25-Diamond I
(To:ptc-4749353)

Patrick Seumo schrieb:

the problem with four gaussian is that I can not publish with. it is not scientific. Please I would like to know if the file you have sent you have obtain the fitting using my function.

if yes, thank you very much. I don't know why the file look gray color.

Yes, I used your function unaltered (and unsimplified) with exception that ag0/1 is now a parameter to adjust and the values you had assigned at the top I have deleted - they are the guess values now.

You can see it in the screenshot, too. Can't you see the file?

I turned ag0/1 in a vector as i feel thats easier to handle and has the big advantage that I don't have to redefine the fitfunction f for later usage like plotting, etc. If you don't like that you have to type f(x,ag) everytime after genfit, you can define a new function g(x):=f(x,ag) and use that from then on instead of f.

The gray background is an option I often turn on as it allows me to better see the regions and helps me pushing together and aligning the regions to make a neater looking sheet.

You can turn it off via the menu - choose "view" and uncheck "regions".

You will have to show which variables are the independent and which variables are the dependent. Also, you will have to specify which parameters you are going to adjust.

x is the variable and I adjust with ag0 and ag1 as you can see in the file.

Werner_E
25-Diamond I
(To:ptc-4749353)

Patrick Seumo schrieb:

I adjust with ag0 and ag1 as you can see in the file.

No! Thats absolutely not to be seen in your file!

If ag0 and ag1 are the parameters to adjust, the fit function has to be written to be dependent of them (either singly as a list or as a vector). Then you would have to provide the guess values for your parameters when calling genfit.

You didn't show your attempt to call genfit in the sheet anyway.

My remark about i has nothing to do with genfit, I was trying to help you understanding what you are doing with your vectors. It didn't made much sense.

Announcements

Top Tags