10-06-2022 03:33 PM
Hello,
Is there a way to generate a lorentzian function in labview ?
I'm using labview 2014..
Thanks
10-06-2022 03:51 PM
Yes, just generate an ramp of x values and apply the formula. What is giving you problems?
10-06-2022 03:58 PM
@rmayer wrote:
Is there a way to generate a lorentzian function in labview ?
Sure. A Lorenzian has three parameters: Amplitude (A), Peak Center (x0), and Width at Half Peak (WHP) Write a sub-VI that takes a Cluster having A, x0, and WHP as "fixed parameters" (which define your curve), and pass "X" in as the main (upper-left) parameter. To draw the curve from, say, 0 to 1 with parameters [1, 0.5, 0.3] (which means the peak is 1, it is centered at 0.5, and if you measure its width at 0.5, half the peak value, it will be 0.3), put a range of points, say 0, 0.01, 0.02, ... 0.98, 0.99, 1.0 through this function, using the points as the X coordinate of your plot, and Lorentzian (X) as the Y of your plot.
Do you know how to create a sub-VI (which you can think of as a "Function")? There are some LabVIEW functions called "Ramps" (do a search for this) that can generate for you the X values. Do you know how to use a FOR or WHILE structure to step through an orderly series of values, such as generating X, Y pairs for a plot? Do you know how to plot a Chart or a Graph?
Bob Schor
10-06-2022 04:38 PM
Thanks, it's OK, I managed to create a vi that is doing what I need.
Thanks for your advices
10-06-2022 04:39 PM
I attach my code
10-06-2022 06:33 PM
A few comments:
Here's what I might do.
10-06-2022 06:55 PM - edited 10-06-2022 06:55 PM
From the icon it seems you started with the template for nonlinear fitting. If you want to fit this curve to data, you cannot change the connector pane, so here's how the model could look like.