Get Help

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Genfit confusion

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-10-2011
05:17 PM

12-10-2011
05:17 PM

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

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-12-2011
11:59 AM

15 REPLIES 15

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-10-2011
05:42 PM

12-10-2011
05:42 PM

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.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-11-2011
03:58 AM

12-11-2011
03:58 AM

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-11-2011
02:18 PM

12-11-2011
02:18 PM

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-11-2011
03:27 PM

12-11-2011
03:27 PM

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-11-2011
11:05 AM

12-11-2011
11:05 AM

Re: Genfit confusion

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.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-11-2011
12:51 PM

12-11-2011
12:51 PM

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.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-12-2011
08:01 AM

12-12-2011
08:01 AM

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-12-2011
09:05 AM

12-12-2011
09:05 AM

Re: Genfit confusion

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-12-2011
09:42 AM

12-12-2011
09:42 AM

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-12-2011
09:45 AM

12-12-2011
09:45 AM

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!

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-12-2011
10:23 AM

12-12-2011
10:23 AM

Re: Genfit confusion

Not to worry.

Thanks for your help

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-12-2011
11:59 AM

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-13-2011
08:02 AM

12-13-2011
08:02 AM

Re: Genfit confusion

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-15-2011
03:03 AM

12-15-2011
03:03 AM

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-15-2011
02:59 PM

12-15-2011
02:59 PM

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

See for example - http://twt.mpei.ac.ru/ochkov/Mathcad_12/3_26a_minimum_Trace.gif