Skip to main content
1-Visitor
December 10, 2011
Solved

Genfit confusion

  • December 10, 2011
  • 14 replies
  • 13293 views

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)

Could you please help me?

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.

Thanks a million in advance

Maz

Best answer by RichardJ

See the attached.

14 replies

19-Tanzanite
December 10, 2011

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.

24-Ruby IV
December 11, 2011

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":

Pic_1.PNG

24-Ruby IV
December 11, 2011

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]):

Pic_1.GIF

24-Ruby IV
December 11, 2011

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"]):

Pic_2.PNG

23-Emerald I
December 11, 2011

In additiion to Richard's comments:

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.

19-Tanzanite
December 11, 2011
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.

Maz1-VisitorAuthor
1-Visitor
December 12, 2011

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

23-Emerald I
December 12, 2011

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

Maz1-VisitorAuthor
1-Visitor
December 12, 2011

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!!