From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-04-2012 11:27 AM
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.
10-04-2012 11:32 AM
Nice trick! I'll have to rememeber this one. Update VI is attached.
10-04-2012 01:22 PM
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...).
10-04-2012 01:32 PM
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.
10-04-2012 01:46 PM
10-04-2012 02:01 PM - edited 10-04-2012 02:17 PM
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.
10-05-2012 09:21 AM
Is this working for you now?
12-05-2012 12:13 PM
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
12-05-2012 12:51 PM - edited 12-05-2012 04:50 PM
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?
12-05-2012 11:59 PM
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;