Jump to content
Sign in to follow this  
mermeladeK

Non linear curve fit

Recommended Posts

Hello,

I have a spectrum from a signal and I know how it should be theorically: A/(1+Bf**2)step(D-f)+E

...where f is frequency.

...where A, B, C, D and E are constants that I want to get from the real data.

To solve this problem I try to use the "Non linear curve fit.vi", but it keeps saying:

Error -20041 occurred at NI_Gmath.lvlib:Nonlinear Curve Fit LM.vi

Possible reason(s):

Analysis: The system of equations cannot be solved because the input matrix is singular.

I checked if the array of independent and dependant values are equal, I checked the fitting model and everything seems ok.

You know why it keeps saying the input matrix has no inverse matrix?

Thank you.

I attached a picture with the VI.

post-7658-1170780650.jpg?width=400

Share this post


Link to post
Share on other sites

The issue may not be your code but the input data, can you post the vi with minimal default data that demonstrates the issue.

Share this post


Link to post
Share on other sites

Hello SciWare,

Sorry for the delay. I thought I had posted a message on wednesday but it seems I didn't.

The data wired to the Block is in the next picture. It is a spectrum of a 1/f noise plus a white noise.

I also attach a graph plot of the data contained in the array in the cluster of the spectrum graph.

Nil

post-7658-1171024307.jpg?width=400

post-7658-1171024315.jpg?width=400

Share this post


Link to post
Share on other sites
Hello SciWare,

Sorry for the delay. I thought I had posted a message on wednesday but it seems I didn't.

The data wired to the Block is in the next picture. It is a spectrum of a 1/f noise plus a white noise.

I also attach a graph plot of the data contained in the array in the cluster of the spectrum graph.

Nil

The last bit of the data seems to be trailing off to 0. That might be the problem.

Neville.

Share this post


Link to post
Share on other sites

As soon as I come back and get working on this again I'll tell you if your answer is right. However if I remember well, the last data in the graph was non-zero. I'll try to plot a logaritmic graph so that it is easier to see it's non zero.

QUOTE(Neville D @ Feb 9 2007, 06:58 PM)

The last bit of the data seems to be trailing off to 0. That might be the problem.

Neville.

Share this post


Link to post
Share on other sites

QUOTE(mermeladeK @ Feb 16 2007, 11:39 AM)

As soon as I come back and get working on this again I'll tell you if your answer is right. However if I remember well, the last data in the graph was non-zero. I'll try to plot a logaritmic graph so that it is easier to see it's non zero.

Here I am!

Well, I checked what you said and... it's not about the zeros. I tried a different input for the Nonlinear Curve Fit VI and it keeps saying again the same thing: NI_Gmath.lvlib:Nonlinear Curve Fit LM.vi.

Does any1 have an idea of what is the problem with this VI? :(

Attached the input waveform:

Share this post


Link to post
Share on other sites

QUOTE(mermeladeK @ Feb 9 2007, 04:32 AM)

Hello SciWare,

Sorry for the delay. I thought I had posted a message on wednesday but it seems I didn't.

The data wired to the Block is in the next picture. It is a spectrum of a 1/f noise plus a white noise.

I also attach a graph plot of the data contained in the array in the cluster of the spectrum graph.

Nil

Why don't you post the VI's (and data if any) instead of a picture of the BD.. that will save people time in trying to re-build your work just to re-create your error.

Neville.

Share this post


Link to post
Share on other sites

QUOTE(Neville D @ Feb 26 2007, 10:37 PM)

Why don't you post the VI's (and data if any) instead of a picture of the BD.. that will save people time in trying to re-build your work just to re-create your error.

Neville.

Here are the VI's. The main one is the one with the word "TEST" in the name. The other 2 are subVI's. The "Acquire 1 divided by f idealized spectrum parameters.vi" is the VI supposed to use the Non linear curve fit.

Nil

Share this post


Link to post
Share on other sites

QUOTE(mermeladeK @ Mar 2 2007, 04:36 AM)

Here are the VI's. The main one is the one with the word "TEST" in the name. The other 2 are subVI's. The "Acquire 1 divided by f idealized spectrum parameters.vi" is the VI supposed to use the Non linear curve fit.

Nil

Thanks,

I will take a look at it shortly.. been out of town and lots to catch up on.

Neville.

Share this post


Link to post
Share on other sites

There are several subvi's missing

Spectrum model.vi

Quadradic substract.vi

Noise figure to V.vi

Noise from KeV to V.vi

Post them up and we can take a look at it

Share this post


Link to post
Share on other sites

I took a look at you code but it isn't easy to follow.

I ran it and it produced the reported error which is due to the Lev Mar Curve Fit being unable to calculate a covariance, I'm not sure why though.

What I would strongly suggest is that you check that your curve fit model is correct and that the data that you are trying to fit it to is appropriate. Generate data that fits your model and see if that works, also check your initial coefficients, are they appropriate?

Share this post


Link to post
Share on other sites

Hi,

Following SciWare suggestions I found the problem. It was about estimating one of the parameters. It still gives me an error which I have to find out why, but it gives a good curve now.

I'll post more about it once I solve the last error.

Thanks.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.