05-14-2017 02:36 AM
Please can you send me the VI i really need!!!!!
05-14-2017 09:34 AM - edited 05-14-2017 09:35 AM
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:
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! 😄
05-14-2017 12:29 PM
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:
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
05-14-2017 01:08 PM - edited 05-14-2017 01:20 PM
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 ...]
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:
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
05-14-2017 03:00 PM
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!!!
05-14-2017 03:15 PM
This is the VI i've just created!!!
05-14-2017 04:12 PM
No need to post the same thing twice. If you run it, does it work?
10-19-2021 01:36 AM
Thanks YOU A LOT ❤️ ❤️ ❤️ ❤️
10-19-2021 08:38 AM
@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
01-05-2022 11:43 AM
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?