How do I generate an array of random numbers that relate to an output wave that falls within a certain frequency range?

I have been creating random numbers that I'm using within a system, the system is working fine, but now I have realised that the random numbers must be outputted to speakers in such a way as to filter out all but a low frequency range.
I was thinking about generating a dither signal with a bandpass filter, but could not get it to give me out a full array of 250 values which I could then manipulate.
The sampling frequency of the output is 200Hz and the 250 data points must fall within the 0-100Hz range.
Another course of action I am considering is to use an FFT and an inverse FFT to get the data that I'm looking for, but I'm fair
ly inexperienced with using labVIEW and can't quite get it to work.
Thanks for the help,
Hank.

As you may already know, in the Functions palette/Analysis VIs/Filters VIs are VIs for filtering. There are also some examples for using these filters under Examples/Analysis/fltrxmpl. You may find some of these are related to your situation, especially for filtering out the higher values.
An option is to simply output the random values to a Comparison/"less than or equal" function, where only values <= to 100 would be sent to an array which is in a For loop. Use the iteration counter of the For loop to count up to 250, at which time you would pass the whole array to your next node. This would let you have 250 values between 0 and 100 for your final array.
Good luck.

Similar Messages

  • I have an array in which I want to check and see if it falls within a certain range with about 7 different ranges. I have tried the range and coerce function but something is going wrong.

    Also, I have a timer that lets me know how long the trigger has been active. I want to know if it is possible if that time would be reset everytime the trigger goes off.
    Attachments:
    Code.vi ‏113 KB

    1. Do not run using the Continuous Run button! This is intended only for certain types of trouble shooting and not for normal operation.
    2. Put a while loop around your entire program.  Add a stop button wired to the stop terminal of the loop.
    3. Then you can replace all the feedback nodes with one shift register with the input expanded to five elements. Sum the three bottom ones for your averaging.
    4. Nothing is wrong with the In Range and Coerce.  You should only check it when you have data.  That is what the Data Available output from Trigger and Gate is for.
    5. I am not sure what you want to reset for your timer or exactly when, but it should be possible.
    6. I did not try to figure it all out but you may not need the timer while loop once you wrap the loop suggested in 2 around the rest of the code.  You may be able to move the shift registers to the outer loop. 
    Lynn

  • HELPwith array of random numbers!!!

    can anyone please write up a program that uses an array of random numbers from 0-100 and sort them out...
    if anyone can help me that would be great...i tried but i cannot figure it out...
    please just write the program so I just have to copy and paste :)

    This has to be the most asked question here, or at least it's way up there with classpath and path questions.
    Use the search feature to search the forum for random number generation and I swear you'll find more answers and code than you could possibly want.
    Good luck
    Lee

  • How to fill an array with random numbers

    Can anybody tell me how I can fill an array with thousand random numbers between 0 and 10000?

    import java.util.Random;
    class random
         static int[] bull(int size) {
              int[] numbers = new int[size];
              Random select = new Random();
              for(int i=0;i<numbers.length;i++) {
    harris:
    for(;;) {
    int trelos=select.nextInt(10000);
    numbers=trelos;
                        for(int j=0;j<i;j++) {
    if(trelos==numbers[j])
    continue harris;
    numbers[i]=trelos;
    break;
    return numbers;
    /*This method fills an array with numbers and there is no possibility two numbers to be the
         same*/
    /*The following method is a simpler method,but it is possible two numbers to be the same*/
    static int[] bull2(int size) {
         int[] numbers = new int[size];
    Random select = new Random();
    for(int i=0;i<numbers.length;i++)
              numbers[i]=select.nextInt(9);
              return numbers;
         public static void main(String[] args) {
    int[] nikos = random.bull(10);
    int[] nikos2 = random.bull2(10);
    for(int i=0;i<nikos.length;i++)
    System.out.println(nikos[i]);
    for(int i=0;i<nikos2.length;i++)
    System.out.println(nikos2[i]);

  • How to get the desired total of Random numbers ?

    I m in a big problem and want a urgent solution.
    I want to randomise numbers with specified limit and the total of all the randomised numbers should be desirable.
    e.g. if i m generating random number 24 times in a loop then the total of all the gerenrated numbers should be 100 and each randomised generated number should not be greater than 6.
    Please help me out. is there any method from which i can get, desirable total from the gererated random numbers ?
    Please help.
    thanks in advance

    In my usual manner, I'll throw in a couple of ideas and leave others to discard them again :-)
    Pick random numbers. If, at some point, the sum goes over 100, throw away the last number at instead put in the number that will make the sum exactly 100. Then put in 0 until you have 24 numbers. Those 0s won't look random. If it helps, shuffle all the numbers so the 0 come in random places in the sequence. If it's still not random enough, discard the whole idea. If, on the other hand, you still are m numbers short of 24 numbers and the sum goes under 100 - (m * 6), in a similar manner stop using randomness and throw in the numbers needed to hit 100. Shuffle to distribute the 6s.
    Another idea, there are 100 ^ 24 or 10 ^ 48 ways to put 100 balls into 24 buckets. Find out how many ways there are under the constraint that you can put at most 6 balls into a bucket. Enumerate them, pick one at random and generate it. I would say that this should give you a good randomness, but does it also look that way under your requirements?

  • How can I generate an array of JButton in Eclipse 3.2 ?

    I know something like this shud work ::
    JButton[] barray = new JButton(5); // To create an array of 5 Buttons
    But the problem is that in the JButton class, there is no constructor that takes an integer argument.
    Any ideas ... ?
    Ajay Garg

    Please don't cross post - http://forum.java.sun.com/thread.jspa?threadID=5249328&tstart=0

  • How do I generate random numbers from a list of numbers without repeating any number

    I am trying to generate a list of random numbers without any repeating numbers.  For example say the list is from 1 to 15, how do I randomly generate a list of numbers using each number only once?

    pb,
    You can build a randomizer by making a 2-column table with 15 rows. In Column A, Fill with the numbers 1 to 15. In column B Fill with RAND(). Then sort on Column B. There will now be a randomized list of the numbers from 1 to 15 in Column A. You can copy this random list and use it in your application.
    Jerry

  • How to generate random numbers that doesnt contain characters?

    How do we generate random numbers in ESB ROuting Service/ XSL transformation that does not contain characters. I have been using "orcl:generate-guid()" , but it contains some characters, so, I substring it to get only numbers. I dont want to take this risk and in future, my substring itself may contain characters.
    Has anybdy tried this before?
    Thanks,

    If the goal is to have a pseudo random number then consider using the translate function to replace the occurances of the A - E characters with another digit. For example:
    translate(orcl:generate-guid(),'0123456789ABCDEF','0123456789123456')
    This will produce a 1 for A, 2 for B, etc. While not a valid hex to decimal conversion of the GUID value, it does get around the hex issue and might be sufficient for your purposes.
    I would perform a large sample test to see just how unique the values end up being.
    As for why hex is used, well GUID's are most commonly written in text as a sequence of hexadecimal digits such as: 3F2504E0-4F89-11D3-9A0C-0305E82C3301. i.e. 128 bits represented in 32 characters formatted into 5 sections.
    Hope this helps,
    Peter

  • How can I generate a real-time highchart from my database data?

    I have looked several links; however, I couldn't find a working demo showing how to implement a highchart using data from a database.
    Objective: I want to generate a real time highchart line graph getting data from my database. What I want is very similar to the
    HighChart Demo which provides a real-time highchart with randomly generated values. It is also similar by X-axis and Y-axis, for I want my x-axis to be "Time" (I have a DateTime column in my database) and y-axis to be an integer (I have
    a variable for that as well in my database).
    Please I need help in sending the model data to my razor view.
    Note that I am already using SignalR to display a realtime table. I also want to know if it can be used to automatically update the highchart as well.
    Below is the code snippet of my script in the view. I have used the code provided in
    HighChart Demo link for generating the highchart. Please tell me where should I apply the changes on my code.
    @section Scripts{
    <script src="~/Scripts/jquery.signalR-2.2.0.js"></script>
    <!--Reference the autogenerated SignalR hub script. -->
    <script src="~/SignalR/Hubs"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    // Declare a proxy to reference the hub.
    var notifications = $.connection.dataHub;
    //debugger;
    // Create a function that the hub can call to broadcast messages.
    notifications.client.updateMessages = function () {
    getAllMessages()
    // Start the connection.
    $.connection.hub.start().done(function () {
    alert("connection started")
    getAllMessages();
    }).fail(function (e) {
    alert(e);
    //Highchart
    Highcharts.setOptions({
    global: {
    useUTC: false
    //Fill chart
    $('#container').highcharts({
    chart: {
    type: 'spline',
    animation: Highcharts.svg, // don't animate in old IE
    marginRight: 10,
    events: {
    load: function () {
    // set up the updating of the chart each second
    var series = this.series[0];
    setInterval(function () {
    var x = (new Date()).getTime(), // current time
    y = Math.random();
    series.addPoint([x, y], true, true);
    }, 1000);//300000
    title: {
    text: 'Live random data'
    xAxis: {
    type: 'datetime',
    tickPixelInterval: 150
    yAxis: {
    title: {
    text: 'Value'
    plotLines: [{
    value: 0,
    width: 1,
    color: '#808080'
    tooltip: {
    formatter: function () {
    return '<b>' + this.series.name + '</b><br/>' +
    Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +
    Highcharts.numberFormat(this.y, 2);
    legend: {
    enabled: false
    exporting: {
    enabled: false
    series: [{
    name: 'Random data',
    data: (function () {
    // generate an array of random data
    var data = [],
    time = (new Date()).getTime(),
    i;
    for (i = -19; i <= 0; i += 1) {
    data.push({
    x: time + i * 1000,
    y: Math.random()
    return data;
    function getAllMessages() {
    var tbl = $('#messagesTable');
    var data = @Html.Raw(JsonConvert.SerializeObject(this.Model))
    $.ajax({
    url: '/nurse/GetMessages',
    data: {
    id: data.id,
    contentType: 'application/html ; charset:utf-8',
    type: 'GET',
    dataType: 'html'
    }).success(function (result) {
    tbl.empty().append(result);
    $("#g_table").dataTable();
    }).error(function (e) {
    alert(e);
    </script>

    Hi Sihem,
    Thank you for contacting National Instruments.  Using the LabVIEW Real-Time module, you can do development without actually having a target.  While viewing the project explorer window, you can do the following steps:
    Right click on the project
    Select New >> Targets and Devices
    Select the "New Target or Device" radio button
    Select the target you would like to develop on.Information about the LabVIEW Real-Time Module can be found here.
    Regards,
    Kevin H
    National Instruments
    WSN/Wireless DAQ Product Support Engineer

  • Array Of Random Alphabetic Characters?

    Hi,
    How would I populate an array with random alphabetic characters? Is there a java defined method for achieving this?
    The approach I was going to take was to use Math.random to create numbers between 1 - 26 and use a double scripted array to link the number to a letter.
    This is part of a program to test sorting efficiency.
    Any help would be appreciated
    NIALL

    import java.util.Random;
    class find {
         public static void main (String args[]) {
              find f = new find();
              System.out.println("The Random Character is "+ f.myRandom());
         char myRandom() {
              Random r = new Random();
              int i = r.nextInt(52);
              if (i<26) return ((char)(i+97));
              else if(i>=26) return ((char)(i+39));
              else return('0');
    }u can do this like this code specified above

  • Random numbers

    I'm doing a java program using random numbers.
    I would like to avoid that each generated number, besides unique, is different from its index in array - for instance, the first number in array is not number 1, the second is not number 2, the third not number 3, and so one.
    Can someone help ?
    That�s my relevant code :
         boolean isRepeated = false;
            int [] rNums = new int [t1];
            for (int x = 0 ; x < t1 ; x++)
            do
            isRepeated = false;
           rNums [x] = (int) ((Math.random () * t1) + 1);
           for (int y = 0 ; y < x ; y++)
               if (rNums [x] == rNums [y])
           isRepeated = true;
           break;
           while (isRepeated);

    Any suggestion ?Not really.
    The not reapeating part by itself is easy. Either populate the array with numbers that match the indices and then shuffle, or just keep track of which numbers you've used to far and get the next number in a loop until you get one you haven't used up yet.
    The no-number-at-its index (and by the way, array indices start with 0, not 1) is fairly easy. Say your array is 10 elements, 0..9. So you generate a random number in the range 0..8 (9 possible values). Say we're trying to populate index 3. If the number generated is < 3, then use it as-is. If it's >= 3, then add 1.
    Putting them together is harder. And you could end up with a situation where 0-8 are populated, and the only number that's not used and the only index that's not used are both 9.
    Why are you imposing these restrictions?

  • Non repeating random numbers

    Hi,
    Im writing code to generate 10 random numbers and i have code written so that if a number between 1 and 10 is already chosen, it has to look for another number. heres snippets of the code:
    for (int b = 0; b < 2; b++)
    for (int i = 0; i < a.length; i++)
    int test = (int)(Math.random() * 10);
    boolean r = valueExists(test);
    if (r == (true))
    test = (int)(Math.random() * 10);
    else
    a[i] = test;
    boolean valueExists(int value)
    int z = a.length;
    boolean exists = false;
    for (int j = 0; j < z; j++)
    if (a[j] == value)
    exists = true;
    return exists;
    when i run this code, the numbers do repeat. can anyone help?

    import java.util.List;
    import java.util.ArrayList;
    import java.util.Random;
    public class RandomNumbersDemo {
        private List numbers = new ArrayList();
        private Random random = new Random();
        public static void main(String[] args) {
                 RandomNumbersDemo demo = new RandomNumbersDemo();
            demo.init();
            demo.doThatVoodoo();
        public void doThatVoodoo() {
            while (numbers.size() > 0) {
                System.out.println(getRandomInteger());
        public int getRandomInteger() {
            int element = random.nextInt(numbers.size());
            Integer randomInteger = (Integer) numbers.get(element);
            numbers.remove(element);
            return randomInteger.intValue();
        public void init() {
            for (int i = 0; i < 10; i++) {
                numbers.add(new Integer(i));

  • Creating x random numbers that add up to a certain number

    How would I go about creating 3 random numbers from x - y that add up to a certain number.
    Or how would i create a set of numbers that are random but not repeating.

    How would I go about creating 3 random numbers fromx
    - y that add up to a certain number.Create 2 random numbers. Number 3 = certain
    number - (random number 1 + random number 2)
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Rand
    om.html
    Or how would i create a set of numbers that are
    random but not repeating.Create a List and fill it with numbers 1 - n. Shuffle
    the list with the Collections.shuffle(...) method.
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Coll
    ections.htmlOr use a Set instead of a List, since Sets do not contain duplicates.
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html
    ? {?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Random numbers started appearing on lcd screen.

    I just started seeing random numbers appearing on my LCD Screen;  with that, the pictures also looked unclear.  Has anyone had this happen before?   Are there any fixes?  Thank you very much.  Happy Holidays!!
        Mark

    markpacana,
    Can you describe some of the numbers and where they appear on the LCD screen? (ex.  in one of the corners or on the sides)
    Do the numbers appear after every image that is taken?
    If this is a time sensitive-matter, additional support options are available at Contact Us.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • How can you generate Multiple random numbers from 1 to 49?

    I am very new at programming with the iPhone SDK and I need some help with a project I am working on. What I want to do is set up a window with 6 labels and 1 button. When the user clicks the button, the program will populate 6 randomized numbers each ranging from 1 to 49, and then place each of 6 numbers in a label. But each time the program ends and starts again the numbers cannot be the same, and also when the user clicks the button, no label can have the same number twice, so for example. If label 1 had the number 10, the other 5 labels cannot have that number until the button is clicked again. I know how to set up the interface, I just need the code. I would so greatly appreciate someone's help in this matter. I have been trying to do this for days and I cannot figure it out. Possibly someone who knows tons about Objective C programming can help me!
    Thank-you so very much!!

    I see that you're writing a lottery number generator. Perhaps the easiest way to do it is to emulate a real lottery: fill an array (NSMutableArray, probably) with the numbers between 1 and 49, pick one at random, remove that number from the array, and repeat. (You can think of the numbers as being the balls and the array as being the machine that pops them out.)
    One simple way to get the random indices needed is to extract six random bytes from Randomization Services using SecRandomCopyBytes, then loop over them, using the modulo operator (%) to select an index within the size of the array.
    And no, I'm not going to write your code for you. If I was going to do that, I could package and sell the app myself.

Maybe you are looking for