ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying a logarithmic value on a linear plot

Solved!
Go to solution

Hi all,

 

I am having a mental block and hard time wrapping my head around this issue and how to do it. Let me explain.

 

I am using LabView to drive a Built-in-Self-Test (BIST) on our product. The device has a front panel touchscreen with serial control. 

If you look at the attachment you will see a graphic (made in LabView) which will be displayed on the touchscreen.

The device BIST will feed me the bit-error-rate value (BER) such as 1e-5 errors. 

I want to drop a dot on this graph for this error rate at a certain X value on the graph

My Y range is as follows: 1e-1 = 10 and 1e-9 = 300

Therefore, I have 290 pixels between the top and bottom of my scale.

290/8 = 36.25 pixels for each interval.

1e-1 = 10

1e-2 = 46.25

1e-3 = 82.50

etc...

 

I need to mathematically convert this number to show logarithmically on an x-y scale.

While writing this, I layed out 10 points from 1e-2 to 1e-1 (see Scsreenshot331).. I'm seeing the pattern but can't get the math right.

Plus I need to expand it down to 1e-9.

 

Thanks,

Peter

 

 

 

Download All
0 Kudos
Message 1 of 6
(4,545 Views)
Hi Peter,

Pixel is log(y) * 36.25 + offset...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(4,499 Views)

Why don't you just go to the properties dialog?  Go to Scales and check the box for Log.

 

THat makes your x-scale logarithmic.  No need for fancy math.

0 Kudos
Message 3 of 6
(4,459 Views)

natasftw, you didn't understand.  The device I need to write to is a simple x-y screen. I am not graphing in Windows and the LabView environment.

 

GerdW... That is exactly where I was going... close... but that doesn't work either.

I did figure it out though.

What complicated it for me was that all my Y-paramenters are <1. Log of anything less than 1 is a negative number.

It turns out that the formula is as follows.

 

pixel = (abs(log(y) -1)) * 36.25 +10

 

 

0 Kudos
Message 4 of 6
(4,437 Views)
Solution
Accepted by sdp54321

Hi sdp,

 

pixel = (abs(log(y) -1)) * 36.25 +10

pixel = log(y)*(-36.25) - 26.25 (for 1e-9<=y<=1e-1)

One function less, one addition less…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 6
(4,404 Views)

Hi Gerd,

 

Interesting.... I never think about simplifying.

My code is very clean and readable, but reducing unnecessary steps is something I fail to implement.

I guess if my program had speed critical constraints , I would probably need to be more diligent with that.

 

Peter

0 Kudos
Message 6 of 6
(4,354 Views)