05-12-2020 08:51 PM
05-12-2020 08:56 PM
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.
05-12-2020 09:11 PM
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.
05-13-2020 01:10 AM - edited 05-13-2020 01:11 AM
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)?
05-13-2020 07:56 AM
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,
05-13-2020 09:37 AM - edited 05-13-2020 09:38 AM
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.
05-13-2020 05:13 PM
Thank you so much. Got it!