取消
显示结果 
搜索替代 
您的意思是: 

nonlinear fit model function

已解决!
转到解答

Hi, I'm trying to use a custom fit - fitting modified error function to the provided data. 

For the nonlinear fit I need a model fitting function VI, which I created from template (attached LM_erf_model.vi). 

I have a problem connecting the reference for the attached function to f(x,a) input of the Levenberg-Marquardt

nonlinear fit VI - I can't create the proper reference and end up with

 '

You have connected a refnum of one type to a refnum of another type and both types are members of some class hierarchy, but there is neither a simple up cast nor type cast between the two classes. 

'

 

What's the proper way of creating the reference for this model function to be used in marquardt test .vi?

 

Regards

Michal 

Message Edited by mdwuznik on 01-29-2009 01:07 AM
下载全部
1 条消息(共 10 条)
6,234 次查看
解答
接受人 mdwuznik

SOLVED!

 

Wiring proper type to 'open VI reference' input solves the referencing problems.

Still need to find what causes the singularity of the equation set... 

2 条消息(共 10 条)
6,222 次查看

It is typically much easier to place a static VI reference on the diagram, then

  1. right-click...browse for path...point to the model VI
  2. right-click the static reference and make it strict (red star)
  3. hook it up the the nonlinear fitting VI, ignore the coercion dot. 😉

 

Your model functions is overly complicated. Index array is resizeable, so get the three parameters before the loop at once. No need to index the same element with every itreation of the loop. I would recommend not to use a formula express VI.

 

 

Do you have some typical data?

 

Message Edited by altenbach on 01-28-2009 05:50 PM
下载全部
3 条消息(共 10 条)
6,219 次查看
Also remember you MUST initialize the error shift register, else you would always start with an error if an earlier call to the subVI ended in error.
4 条消息(共 10 条)
6,211 次查看

Thanks a lot for your help,

 

I figured out the fitting, I attach the working test version with very real-like data.

Instead of Express Formula I used the Mathscript field, which seems sooo slow...

 

Any insights on replacing that particular fit with sth faster? (I know, mathscript is not really a speed demon, though erf() is not that popular to be understood in 'formula string'...), and on the other hand I find calculating gaussian peak and integrating afterwards a bit on the cheating side (though I've done numerically worse things) . As for the example - I like the quality of fit very much, though I would appreciate some tenfold increase in speed 🙂

 

Regards Michal

下载全部
5 条消息(共 10 条)
6,180 次查看

For speed, you should use plain wires. 🙂

 

Also, your model VI is broken, it does not compile here. Yesterday, I made a quick rewrite and it seems to work fine with your new data. try it.

 

 

6 条消息(共 10 条)
6,167 次查看

Here's a picture of the model and a fit of your data.

 

Message Edited by altenbach on 01-29-2009 09:25 AM
7 条消息(共 10 条)
6,165 次查看

Hmm, 

I do not know why on some machines my vi complains about CDNC....vis for arithmetic. No problems with pure wires, though 

this reminds of pure assembler snippets in C.  As useful & speedy as ugly looking:).

The speed increase is moreless thousandfold. Yes, plain old wires are fast.

 

Kudos.

Michal 

8 条消息(共 10 条)
6,148 次查看

My model VI was a bit hurried, so here's a probably slightly faster version. (e.g. we can eliminate the +1 at the end if we initialize the shift register with 1. Also, several opareations can be done on the scalars instead of arrays). There are probably further improvements possible.

 

Shouldn't make much of a difference, but cleaner is always nicer. 😉

 

Message Edited by altenbach on 01-29-2009 10:58 AM
下载全部
9 条消息(共 10 条)
6,137 次查看

No much difference when collecting the datapoints for 128 traces will take ~10 minutes (no, not wasting 99,99% of the time), and one fit takes 20 ms, which means 2 secs for all the traces :). Thanks anyway. 

 

 

 

10 条消息(共 10 条)
6,122 次查看