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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a Logarithmic Trendline to an X-Y Graph

In my VI I am taking measurements from a DAQ, calculating phase shift and frequency and writing it to a TDMS file.

After I have this TDMS file I want to make a scatter plot of the data on an X-Y graph with a logarithmic trend line. I am plotting phase shift (Untitled 1) versus frequency (Untitled). I succeeded in graphing the data, but I am having trouble adding the trendline. I have attached the VI in question. I tried to attach the TDMS file, but the forum does not allow such attachments.

 

Thanks for any help or suggestions that you can offer.

0 Kudos
Message 1 of 2
(2,546 Views)

Hi,

 

I had a little look over the relevant part of your vi. The log fit function returns an array of y values, so you can plot these against x, and add it to your graph alongside the actual values.

One way to do it using the functions you've implemented is like this:

 

log xy snippet.png

 

See if this works.

 

One extra thing that might be helpful, you don't have to open the TDMS file twice, you can just open it once then do as much reading as you want, then close it once. (you can read multiple channels at once too, using an string array as the channel name input to the TDMS read.

 

All the best,

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
Message 2 of 2
(2,526 Views)