LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a constant barrier like square function but without repeating? I want to simply have a constant bump in arbitrary point (C)and controllable width (W).

Solved!
Go to solution

I don't know what you mean by the "phrase constant barrier".

 

And please don't create a long question in the subject line and just a picture in the message.  The subject should be short and to the point, with the details and picture in the message.

 

What are you doing with this?  Is this meant to be output through a DAQ device?

 

You can use functions in the array palette like Initialize array and Build Array to create stretches of constant 0's and constant 1's that you then concatenate to each other.

0 Kudos
Message 2 of 7
(2,168 Views)

 

 

Thanks for your quick response and sorry about making the question very long. Yes I want to create 0 and 1's. I combined two sign functions and achieved that. I was wandering whether there is another way. Sorry I'm very new here. 

 

So I have an input data (spectrum) and I want to create a transmission filter that allows the data pass ( multiply by 1) and eliminate other part of the spectrum ( multiply by 0). So , I want to create this filter and then multiply this outcome by the original spectrum.

0 Kudos
Message 3 of 7
(2,150 Views)

Hi Alias,

 

so you want to create an array with as much elements as your spectrum array?

So you need the functions ArraySize and InitArray.

You want to place just 0 and 1 in the elements? You already got those zeros after InitArray, now you just need to replace some elements by ones. Use ReplaceArraySubset!

(You might also use functions from the SignalGeneration palette…)

 

What have you tried so far? Why don't you attach your VI (or a snippet from the VI)?

Best regards,
GerdW


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

That's exactly what I want. The same number of elements as spectrum array has. I will try your suggestion. However, I like to understand why this is not working. So I break down the problem. 

 

As you see in the attached codes, the file named 1, works. I used a sign function. But for file named 2, I tried to shift the step from origin. but it nothing appears in the plot. So if file 2 works, I can combine two sign function and subtract/add them to result in what I am looking for ( a bump-like transmission filter).

 

Thanks,

Download All
0 Kudos
Message 5 of 7
(2,085 Views)
Solution
Accepted by topic author Alias110

In #2 VI, you are taking your array, but then subtracting an empty array from it.  That leaves you with an empty array.  So nothing!

 

Perhaps you want to subtract a constant from your first array?

 

If you want your 2nd VI to be the mirror image of the first VI, just use your first, then to a reverse 1D array.

 

Then you can concatenate the arrays to get a symmetrical 0, 1, 0 digital square wave.

0 Kudos
Message 6 of 7
(2,070 Views)

Thank you so much. Got it!

0 Kudos
Message 7 of 7
(2,055 Views)