05-05-2020 03:25 PM
Create a VI to generate a random floating-point number between 0 and 1 every second and repeat for a finite number of iterations specified by the user. The VI will then return the largest number generated. An indicator will be used to count the number of iterations elapsed.
Please help me to solve this. Thank you
Solved! Go to Solution.
05-05-2020 03:32 PM
Lets see what you have so far...
Where are you getting stuck?
05-05-2020 03:39 PM
Sounds like a homework problem. We're not here to do your homework, of course. But we can help you with specific problems you have with your attempt. Can you post your existing VI?
05-05-2020 04:49 PM
Hint: use a FOR loop. Use a Shift Register to hold the largest value. I'll let you figure out the rest.
05-06-2020 01:10 AM - edited 05-06-2020 01:11 AM
Hi Atira,
you don't need a shift register as your requirement is to return the largest random number when the VI exits.
(The shift register will help you to reduce memory requirements while the VI runs, when the user chooses to run the VI for a larger number of iterations.)
With so many suggestions you should be able to solve your homework!
05-06-2020 11:07 AM
Is this correct? I think this is so simple. Can I add something else?
05-06-2020 11:11 AM
Is this correct? But I think this is so simple? I want to add something to look this not simple
05-06-2020 11:14 AM
What do you mean I don't need a shift register? So who should I use?
05-06-2020 11:19 AM
You are close. Here are a few of the changes I would make.
I would use the point by point max value. That is what you said that you were looking for. You can use the built in function to increment for the iteration count.
05-06-2020 12:26 PM
@AtiraSuhaimi wrote:
Is this correct? But I think this is so simple? I want to add something to look this not simple
Yep, that code does what you want and it's as simple as it needs to be. You can use the Pt-by-Pt VI to remember the max value if you want, but the shift register works just fine. You could also use an array to store ALL of the values, then get the max array value. Any of those work just fine.
Simple is good!