LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Signal generation from number of harmonics

Please can you send me the VI i really need!!!!!

0 Kudos
Message 41 of 50
(1,954 Views)

Hi ptavernise,

 

If you could add Waveforms together (which you should have found you cannot),

Well, I suggested to add waveforms because you can do so:

check.png

But: you need to know/understand the purpose of the case structure. And you need to find out what's happening in the FALSE case. Atleast a bit of homework for you! 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 42 of 50
(1,960 Views)

Very good.  Your post shows that (a) you know how to use a For Loop and a Shift Register to sum array elements (assuming you can add the components of an Array, as you can with numbers, but not with Waveforms), (b) you don't understand how to use the Cleanup Block Diagram button (the one with the Broom) to make your code "look neat" and easier to read, and (c) you didn't look in the Numeric Palette to find the Sum Array function:

Sum Array.png

 

I'll post another function in a few minutes that you might find useful, particularly if you read my earlier posts about this assignment ...

 

Bob Schor

0 Kudos
Message 43 of 50
(1,955 Views)

You've been struggling with this assignment for several days, and you don't seem to be making any progress, despite strong hints from several of us.  In my case, I suggested that you "start over with pencil and paper", and talked about generating your own Sinusoid instead of using the built-in Signal Generator, as it would (a) give you practice in "Practical LabVIEW", including using For Loops to generate arrays, possibly using sub-VIs to do the functions, and thinking about what you want to do, and (b) it would give you a means to solve your "real" question, how to get the sum of all the harmonics.

 

So here are two pictures.  The first is a sub-VI I called Sin (2 pi k f t) -- it takes k, an I32 "harmonic" (default 1), f, a Dbl "frequency" (default 1), and t, a Dbl "time", and returns Sin (2 pi k f t).  [Oops -- I pushed "Post" too soon -- I'm going to Edit this and finish it ...]

Sin(2 pi f t).png

 This is the code for the sub-VI.  You'll see a picture of this sub-VI in the next Snippet.  Note that the sub-VI uses the 4-2-2-4 (default) connector pattern, has Error In and Error Out on the lower corner, and has an icon (pretty simple, but still useful).

 

Now, here is some code to generate a 1000-point sinusoid starting at t = 0, given a Harmonic, a base Frequency, and a time increment, dt:

Create Harmonic Sinusoid.png

Do you see that putting the Sin (kft) function in a sub-VI and labeling it with an Icon makes it very clear what this (simple) code does?

 

Now, before I go, I want to ask you to go back to pencil and paper (not that I believe that you ever followed this suggestion, you just wanted someone to "do it for you") and consider your original problem.  You want to sum multiple sinusoids and get the resulting "sum of sines" waveform.  The above Snippet shows that generating one sinusoid involves a sum.  It (logically) follows that getting a "sum of sines" must involve a "sum of a sum", or two sums.

 

Here's the question -- which sum should you do first?  

 

Here's a partial answer -- if you know any math and know how sums work, you'll say "it doesn't matter which order you do the sums, you'll get the same answer".  This is true.  I happen to think that one "order" makes for much simpler LabVIEW code, but I leave that to you to explore.  If you are really interested in learning LabVIEW, and in understanding how to generate LabVIEW code, and for your classmates who may be following this Forum discussion and may want to "learn a little extra" as well, I recommend you try writing code to do the sums in both orders.  Verify you get the same answer (or same-looking graphs), and ask yourself which order was easier to program.

 

Bob Schor

0 Kudos
Message 44 of 50
(1,953 Views)

I've just created this VI using shift register.I hope this is gonna work as well as the assignment required!!!Please can you tell me if it works!!!

0 Kudos
Message 45 of 50
(1,946 Views)

No need to post the same thing twice.  If you run it, does it work?

0 Kudos
Message 47 of 50
(1,940 Views)

Thanks YOU A LOT ❤️ ❤️ ❤️ ❤️

0 Kudos
Message 48 of 50
(1,431 Views)

@Ferrar65 wrote:

Thanks YOU A LOT ❤️ ❤️ ❤️ ❤️


Please identify the Reply that you think helped you the most and click "Accept as Solution", which helps other Forum Readers to know that "a solution has been found".

 

Bob Schor

0 Kudos
Message 49 of 50
(1,422 Views)

disliked: Do you homework on your own to earn your grade.

 

could we not have just pointed newbie to the built in VIs without all the condescension?

0 Kudos
Message 50 of 50
(1,370 Views)