02-21-2015 02:09 AM
i had to write a programme that displays one cycle of a sine wave with amplitude 1 I managed to do that i think, the problem am having is I have to use a loop to calculate the RMS VOLTAGE but I shouldn't use any built in functions such as square, triangle, saw-tooth etc
I have attached part of my programme
02-21-2015 04:56 AM
02-21-2015 08:54 AM
It sounds like this might be an exercise to teach you some things about LabVIEW.
- The stop condition >= 6 does not give you a complete cycle. The sine function requires the input to be in radians. For one complete cycle the final value needs to be two pi radians larger than Initial x.
- The use of Build Array inside a loop is generally not a good practice. Why? Because it causes frequent re-allocations of memory as the array grows. It will work OK with the small arrays you are using but learning to do it properly will help you avoid problems later. You can calculate the exact array size before the loop starts so you can use a for loop with autoindexing or Initialize Array, a shift register, and Replace Array Subset in either a for loop or a while loop.
- As crossrulz pointed out, you do not need a loop (unless you want to generate the X-array that way). All the numeric functions you need such as Sine and Square Root are polymorphic. That means they will work on arrays as well as scalars.
Lynn