07-12-2021 10:05 PM
Hello All,
I’m facing a hurdle in solving a problem. Probably you can help me.
I’m doing scaling my 1D array data to "0". Scaling is working fine but now I’m trying to scale data by a range. I tried like this (I put Input and output as a dummy control so you can leave it):
The problem happening here, after scaling within the range graph is showing an edge in the end. Please see the attachment (Before and after scaling)
Will be great if you tell me where I’m messed up.
Thanks,
- Reduanul
Solved! Go to Solution.
07-13-2021 01:22 AM - edited 07-13-2021 01:26 AM
Hi REDUANUL,
@REDUANUL wrote:
I’m trying to scale data by a range. I tried like this (I put Input and output as a dummy control so you can leave it):
The problem happening here, after scaling within the range graph is showing an edge in the end.
The plot you get from your VI is totally correct (as you programmed it)!
Btw. it would help you and us when you would use the AutoCleanup tool before attaching snippets…
07-13-2021 01:42 AM
@REDUANUL wrote:
I’m doing scaling my 1D array data to "0".
As a first step, you need to explain what scaling data to "0" actually means. Scaling is typically a multiplication. Are you talking about an offset or range? I assume you just want a linear transform of the two Y values. Seems trivial.
07-13-2021 05:43 AM
@ altenbach,
Actually, that was my effort. I'm not saying I was correct.
I have an XY graph and wanted to scale the Y-axis value to "0" then there should be another thing that I have to do which is Scaling this value (Y-axis data) within a range (i.e from 100 to 500 whereas array value is 10 to 5000).
Is there any way to do it?
07-13-2021 05:51 AM
Hello GerdW,
"You do some scaling to the Y data of your plots."
- Yes I want to do scaling my XY plot data to "0" then I want to choose a range for scaling (for Y-axis data).
I got it using "InRangeAndCoerce" was a wrong step!
07-13-2021 05:51 AM
Hi Reduanul,
@REDUANUL wrote:
which is Scaling this value (Y-axis data) within a range (i.e from 100 to 500 whereas array value is 10 to 5000).
Is there any way to do it?
Ever heard of simple basic math?
z = (y - y_min)/(y_max - y_min) * (range_max - range_min) + range_min
with
y_min, y_max = [ 10, 5000]
range_min, range_max = [100, 500]
This is basic linear algebra…
07-13-2021 10:12 AM
Sometimes you can even forget all the math details and use the built-in tools that LabVIEW offers. (For example linear fit and linear evaluation). You would use what you have (data min&max) and what you want (limits A&B) as inputs.
In this simple example, the red data is independent of the amplitude and offset inputs used to generate the white data. (unless you have some pathological edge case, e.g. an amplitude of zero.