From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to model sin(a*t) value with 1 step from t= 0 to 100 in control & simulation loop in labview

how to model sin(a*t) value with 1 step from t= 0 to 100 in control & simulation loop in labview ? 

0 Kudos
Message 1 of 6
(841 Views)

You need to learn a bit of LabVIEW.  There are tutorials listed at the beginning of this Forum, there are tutorials you can find on the Web on learning LabVIEW.

 

Do you have any experience with programming?  Any language?  BASIC?  C?  Python?  Do you know about loops?

 

Note that LabVIEW is a little different from the programming languages noted above -- it is graphic, rather than textual, with data (such as numbers) traveling over "wires" (it was invented by engineers to help engineers design "virtual instruments" that would handle control, data acquisition, and other practical things that engineers do.

 

How would you solve your Homework Assignment?  Can you solve this simple problem in any programming language?  The first few LabVIEW tutorials (either those listed on the first page of this Forum or those on the Web) should show you how to do this by yourself in LabVIEW.  Please try it, and if you get stuck, reply, attaching the code (a file with the extension ".vi" that you wrote) and we'll provide advice and help.

 

Bob Schor

0 Kudos
Message 2 of 6
(808 Views)

Hello sir

First of all, thank you for your reply. I watched the videos, I know python programming language.

Since I did not add a for loop in Labview Control & Simulation, it cannot specify a range. That's why I'm asking for help.

1.png

0 Kudos
Message 3 of 6
(779 Views)

Let's "begin at the beginning".  I'm assuming when you say "model sin(a*t) with 1 step from t = 0 to 100", what you mean is that you want to use values of t that start at 0, then 1, then 2, ... then 100.  I'm going to stick with "plain LabVIEW" (skipping Control & Stimulation loop).

 

You need a Loop.  Since you know the values of t, you know how many times the loop needs to run (is it clear that N = 101, not 100?), so a For loop sounds simpler than a While.  The Index in a For (or While) loop takes on integer values, 0,1,..., just what you want for "t".  By convention, the index is symbolized by "i" and is an integer, so why not use it?  [You can always pass the I32 "wire" through a "to Dbl" if you want].  So now you need sin (a*t).  First, do a*t (or a*i), where "a" is probably a Front Panel numeric Dbl control (so you can let the user "choose" it before the program runs).  You can find the "sin" function on Mathematics palette on the Block Diagram (look in the "Elementary" sub-panel under "Trigonometry".  The output will be sin(a*t) for each of the 101 loops that the For Loop executes.

 

If you are using a Control & Simulation loop, surely you know all of this, right?  So help us understand what the real question or problem you are having.  It seems illogical to me that you'd be using Control and Simulation loops without being able to understand how to use a loop to produce 101 points of a sinusoid ...

 

Bob Schor

0 Kudos
Message 4 of 6
(744 Views)

Of course I know the for or while loop. But I don't know how to generate the number from t=0 to 100 in 1 steps in Control & Simulation loop. I'm already asking for help with the Control & Simulation loop loop.

0 Kudos
Message 5 of 6
(729 Views)

Sorry, I didn't really understand the problem (I've not worked with the Control and Stimulation Module).  There is a Tutorial here that may be helpful.

 

Bob Schor 

0 Kudos
Message 6 of 6
(711 Views)