05-08-2017 03:21 AM
Hello, I was trying to performe a nonlinear curve fit of a sinusoid that I get from my oscilloscope. I thought it was kind of simple, I looked at some of the examples and I read some related topics on this forum (this is the closest one to my goal in my opinion: http://forums.ni.com/t5/forums/v3_1/forumtopicpage
My goal is basically to reconstruct a sinusoidal curve when the signal is not completely visible in the display (or let's say to calculate my maximum/minimum value and the zero-crossing.
I attach a VI with three versions of the same 10GHz signal, the first one where the signal is completely visible, the second one where it's out of scale in the X axis (not the whole period is visible) and the 3rd one where the Y axis (amplitude) is out of scale.
I hope you can help me! Thanks!
Thank you!
Solved! Go to Solution.
05-08-2017 04:43 AM - edited 05-08-2017 04:45 AM
Here's an example for the first dataset:
And here it is for the second dataset (after adding a fourth parameter):
I would also recommend a VI model. Formula strings are relatively inefficient.
05-08-2017 04:54 AM - edited 05-08-2017 04:55 AM
And here's the last one (after cleaning up the data). Make sure to use a continuous x-ramp to simulate the guess and best fit.
05-08-2017 05:04 AM
Can you please attach the VI that did that? I have LabView 2015.. Thank you so much!
05-08-2017 05:12 AM - edited 05-08-2017 05:14 AM
@cassaniti wrote:
Can you please attach the VI that did that?
Did what?
You can clean up the third dataset e.g. as follows:
(this retains only data points where y is between -1 and 1)
Sorry, it is 3am here. I need to sleep now.
05-08-2017 05:17 AM - edited 05-08-2017 05:43 AM
This works fine for the first and the second case, but for the third one it doesn't. What am I doing wrong? How do I create a VI model to increase efficency?
05-08-2017 10:09 AM - edited 05-08-2017 10:09 AM
You turned the entire LabVIEW program into Gibberish.
Try this...
05-09-2017 01:40 AM
Thanks a lot! I am filtering so specifically because those are the values that my oscilloscope gives me when the values are out of scale, while I might have a signal with (useful) values greater than 1V. And you're right, I was confused between the use of the ramp and the use of the guess.
Anyway I was wondering if with the VI Model the guess would be faster, because the fit takes a couple of seconds and I'm using this approach in order to reduce the whole time needed to run a complex algorithm..
09-08-2018 09:28 AM
Pl post this VI in 2012 version
09-08-2018 01:30 PM
@AjayShankar wrote:
Pl post this VI in 2012 version
Here's a downconversion to 2012.
(And yes, the VI is just a very rough draft. For significantly better performance, it should be rewritten using a VI model and analytical partial derivatives. Also, the filtering loop could use an "in range & coerce" to remove other blatant outliers.)