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

SOLVED
Newbie

## Genfit confusion

Good evening all,

I'm having a problem with Genfit. I don't really know how to use it properly.

I have a data file. I plot the histogram. I want to use Genfit to give me a better curve instead of the histrogram so I can then try to get what we call threshold voltage (a kind of middle line of the two probablity distributions)

As I understand it at the moment, you need to create a matrix, give the original function as the first value and then first derivatives against each variable in the following rows, but when I do this mathcad doesn't like it and I don't know why. It says something along the lines that they need to have the same number of values when I give it genfit(v,h,guess,D) the guess one goes red. I'm confused

I attach the files for you to have a look at. They include the assignment set, the data given, and then what I've done so far. I have to try to improve on this a bit by Monday (and hopefully learn from you. I'm not trying to cheat) and then hand in the assignment on Thursday so would really appreciate your help.

Maz

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: Genfit confusion

See the attached.

15 REPLIES 15

## Re: Genfit confusion

You have two problems that jump out immediately.

First, at the top of the sheet, on the right, is s statement that strips the header rows from the data. It is not doing anything, because your data matrix is V, but the statement is applied to a matrix VH.

Second, your guesses are way off. Evaluate f for your guesses and and look at the results. They should be at least reasonable close to the values in h.

## Re: Genfit confusion

Hello!

 Maz wrote:...I have a data file. I plot the histogram. I want to use Genfit to give me a better curve instead of the histrogram so I can then try to get what we call threshold voltage (a kind of middle line of the two probablity distributions)...

Try to use for your function a method of smoothing of the data. See examples in attachment. Also look at "Mathcad Help" (hotkey F1) in the search for the keyword "smooth":

## Re: Genfit confusion

And here that turns out with use of the built in function of smoothing "medsmooth(Y, n)" ("n=3" - the parameter defining number of windows of smoothing into which the interval will be divided at data analysis ["n" can be only an odd number, strictly smaller amounts of elements in sampling]):

## Re: Genfit confusion

Another variant for the given task is to use of a regression with usage of several segments of a polynomial (with usage of built functions "interp" and "loess" [thus, the parameter "span=0.3" here is used - sets a level of a smoothness of the data, in practice "0.2 <span <2"]):

Sapphire III
(in response to Maz)

## Re: Genfit confusion

Genfit needs a vector of coefficients, the D function should have only two arguments. (Read the help file.)

Genfit is also picky--setting up a solve block with Minerr will give you a fit to two normal distributions.

## Re: Genfit confusion

 Genfit needs a vector of coefficients, the D function should have only two arguments. (Read the help file.)

Thatused to be true. In MC15 it can also take a list of arguments.

 Genfit is also picky--setting up a solve block with Minerr will give you a fit to two normal distributions.

Agreed. But it will still need much better guesses than the ones provided.

## Re: Genfit confusion

Hi everyone,

Thank you for the replies. My lecturer is insistant on our using Genfit because everyone is using it and I guess it's easier to compare and grade.

Richard,

You were quite right (of course) about the two big mistakes thanks.

I have corrected my mistake of stripping the headers.

I also corrected the standard variation problem (I'd calculated the mean instead which made the answers way off)

The next thing I noticed was that I can't use N0g, NT, and N1g because they're too big. I have to use a0 and a1 which are going to be 0.414 and 0.596 instead which will give me better values.

I'm having problems with getting the derivatives now though. My lecturer is quite insistant on our using Genfit and I'm stuck in a loop now.

If I say of f(v,v0,v1,a0,σ0,σ1) wrt v0,v1,a0,σ0,σ1 it'll give me the error of pattern match exception. Others I'm working with have done the exact same thing and don't have that problem. What am I doing wrong? I thought it might be because I don't have a 'v' in the derivative section, but if I do that it'll tell me it's not a square matrix!

Genfit is confusing and I'm sooooooooo bad at this whole programming thing.

What am I doing wrong? Feeling really dumb here!

Thanks again

Maz

Sapphire III
(in response to Maz)

## Re: Genfit confusion

You can use the symbolic solver to find the derivatives (one by one)

## Re: Genfit confusion

Thanks Fred. I think I got that bit now.

Although with some data files I get correct values and the correct graphs (we obviously need two) but then sometimes I only get one. eg. for Laser at 1Km.

Very strange!!

Sapphire III
(in response to Maz)

## Re: Genfit confusion

 Maz wrote:Thanks Fred. I think I got that bit now. Although with some data files I get correct values and the correct graphs (we obviously need two) but then sometimes I only get one. eg. for Laser at 1Km. Very strange!!

The mathcad I can help with; the physics, not so much. Good Luck!

Not to worry.

## Re: Genfit confusion

See the attached.

## Re: Genfit confusion

It is interesting to see by animation help how the genfit function works:

## Re: Genfit confusion

The genfit animation failed during playback about frame 200. Is there something I need to do to prevent this on my computer to view the animation to completion? It still is very informative.

Best regards

## Re: Genfit confusion

 Michael Overeem wrote:The genfit animation failed during playback about frame 200. Is there something I need to do to prevent this on my computer to view the animation to completion? It still is very informative.Best regards

Thanks, Michael for the interesting. The origin video in attach.

I use the function trace for creating same video. Would you like to know how?!