LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fit data to a tilted ellipse

I am trying to fit a set of data to a tilted ellipse which takes a general form of Ax^2+Bxy+Cy^2+Dx+Ey+F=0. I modified the NI example Fit ellipse.vi to use the nonlinear curve fitting but had no success. Can someone take a look at the code and help me identify the issues? Thanks a lot.

Download All
0 Kudos
Message 1 of 11
(4,339 Views)

Hey dzwang,

 

What is not working in the manner you want? I noticed that you removed the graph that was present in the example, so if it is not graphing that is why. Please be more specific about what you are trying to accomplish, and what issues you are encountering. 

 

Thanks!

kgarrett

District Sales Engineer
0 Kudos
Message 2 of 11
(4,297 Views)

I have the same trouble! I don't know if you already found how to resolve it. The issue that when I run the VI the parameters I get are really small, almost zero. I will appreciate if you can give some highlighs about what to do..

0 Kudos
Message 3 of 11
(4,189 Views)

Good Afternoon,

 

Have you modified the example VI's at all like dzwang above or are you using the exact ones that are provided by NI?  Could you post a copy of your code if you have changed it?  I hope you have a great rest of the day!

 

-Cody C

0 Kudos
Message 4 of 11
(4,169 Views)

@AndreaG47 wrote:

The issue that when I run the VI the parameters I get are really small, almost zero. I will appreciate if you can give some highlighs about what to do..



Because there is a trivial solution for Ax^2+Bxy+Cy^2+Dx+Ey+F=0!

 

It is A=B=C=D=E=F=0, right?

 

Try to fit e.g. in spherical coordinates or some other transform, for example.

0 Kudos
Message 5 of 11
(4,161 Views)

 

I just modified the VI that implements the fitting model. When I got the answers, I realized that it was the trivial solution I though it was a inicialization issue but when I changed the inicial parameters, I got the same result :S 

I'm going to try changing to polar  coordinates, but I think that I would get the same result because the equation is equals to zero.

 

I've attached the VI's I'm using.

Thanks for your willing to help 😄

 

Download All
0 Kudos
Message 6 of 11
(4,155 Views)

You need to re-parameterize the model, not the data, e.g.

 

  1. Xcenter
  2. Ycenter
  3. long axis lenght
  4. short axis lenght
  5. tilt angle

 

for example. (see also this much more complicated problem)

0 Kudos
Message 7 of 11
(4,146 Views)

Hello! Let me tell you that I've made some changes in the VI that implementts the fitting model: I've rearrange the equation and now I'm getting the parameters (a,b, xo, yo and theta). I've attached the VI so you can take a look. It works almost every time, as you know the angle must be a value between 0 and pi/2 and I don't know hao to put a constraint in the model. I tried to put it in the formula node but it doesn't work, can you please give me some help about how to do that?

 

Also, I've review the VI you post in the other thread, it was really good buy too complicated for me and I can not use them now, but I'm sure that I'll review it in the future.

0 Kudos
Message 8 of 11
(4,131 Views)

Hi Andrea,

 

The answer to your question on how to constrain the "t" value depends on how, specifically, you want to constrain the model. If you want to coerce the values to fall within that range, the In Range and Coerce Function (found in the Comparison Palette) could be used to manipulate the values to fall within the limits. Another option would be to use the Quotient and Remainder function (found in the Numeric Palette), dividing by pi/2 this would give the extent that the value differs from pi/2 (useful for your sine and cosine applications). A final option would be to ignore the results when the "t" value does not fall within the correct range. This could be done by checking whether the value is within range and using a Case Structure (found in the Structures Palette) to perform the function only if this is true.

 

I hope that information is helpful!

 

 

Matt
NI Community Team
National Instruments
0 Kudos
Message 9 of 11
(4,111 Views)

Is there the possibility to either post also older LabView versions vi's or block diagram images or more detailed descriptions regarding this thread?

 

Due to project SW state I'm always bound to older Versions of LabView for some time period. (currently LV9) It's a pity that often the forum resources are not helpful just because of no downward compatibility.

 

I would be pleased if somebody could post the ellipse problem thread as mentioned above.

 

Thanks a lot in advance!

 

Best Regards!

0 Kudos
Message 10 of 11
(4,065 Views)