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

Showing results for

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

altenbach

Knight of NI

10-04-2012 11:27 AM

Options

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

Create an indicator after the read operation to display the read data. After running, right-click the indicator terminal and "change to constant". Delete all code to the left of it and we have a VI with the data built-in.

nikodem

Member

10-04-2012 11:32 AM

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

Nice trick! I'll have to rememeber this one. Update VI is attached.

altenbach

Knight of NI

10-04-2012 01:22 PM

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

Your array to cluster has the output size set to 9 elements (the default), thus it is incompatible with the cluster of 2 elements inside the model. As a first step, you need to set the cluster size to 2 (right-click the array to cluster...cluster size...).

altenbach

Knight of NI

10-04-2012 01:32 PM

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

Your data also contains a vertical offset, meaning you need one more parameter. Just add one more parameter defaulting to 0, and inside the model, expand the initial "index array" by one point and add the output to the array at the very end.

I get an offset of 116.043, so for a first try simply subtract that value from your data so you can use the current model. Then implement the offset.

altenbach

Knight of NI

10-04-2012 01:46 PM

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

Here's what I had in mind (LV 2010).

altenbach

Knight of NI

10-04-2012 02:01 PM - edited 10-04-2012 02:17 PM

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

Also, your data looks quite circular, so you might be able to reduce the model to a single width and also eliminate the rotation.

Here's a quick draft.

altenbach

Knight of NI

10-05-2012 09:21 AM

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

Is this working for you now?

errante

Member

12-05-2012 12:13 PM

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

Altenbach,

I am about to use your 2-D nonlinear curve fitting code (or some version of it) to analyze some imaging data that I found today. THANK YOU!!! for posting your code. Quick question. Why do you NOT use the mathscript or formula nodes to generate the gaussian model(s)? I am asking because I might need to implement an assymetrical gaussian model.

Rob

altenbach

Knight of NI

12-05-2012 12:51 PM - edited 12-05-2012 04:50 PM

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

I am a graphical programmer and typically stay far away from any text based code. 😄

It should be equally simple to add some asymmetry. What model do you have in mind?

errante

Member

12-05-2012 11:59 PM

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

Sorry about the text base code, but essentially an asymmetrical 2D gaussian, like the following, but with rotation as well. However, keeping graphic, it looks like it should be relatively easy to modify your 2DgaussianRotationModelwithOffset.vi to do the trick, if need be.

Again, Thanks for posting your code.

Rob

%Function f(x,y)

f1 = exp(-0.5*((x-xc)/sigmax1)^2);

f2 = exp(-0.5*((x-xc)/sigmax2)^2);

f3 = exp(-0.5*((y-yc)/sigmay1)^2);

f4 = exp(-0.5*((y-yc)/sigmay2)^2);

if x < xc

f5 = f1

else

f5 = f2

end

if y < yc

f6 = f3

else

f6 = f4

end

z = offset + amplitude*f5*f6;