Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
I have copied this block diagram directly from my textbook. In the textbook, there aren't any errors that should arise, but in my diagram there is a problem at the bundle going into the XY Graph. Any suggestions?

03-21-2020 09:16 AM - edited 03-21-2020 09:29 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Highlighted
Options

03-21-2020 10:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

To help us to help you, please attach the "code that fails", rather than a "picture of code that might or might not work". This saves us time and effort (which we are "donating", for free).

Bob Schor

Highlighted
Options

03-21-2020 10:23 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Highlighted
Options

03-21-2020 10:32 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

You attached __another picture__, one that partly obscures the picture causing the Error. Assuming you are dealing with LabVIEW, you need to __attach a file with the extension .vi__, that is, __LabVIEW code__. We cannot "edit" a Picture, we cannot (or, at least, I cannot) clearly __see__ a Picture (the pixels are blurry), and when I right-click it, I cannot __execute__ a Picture (to see the Error, also blurry, for myself).

Bob Schor

Highlighted
Options

03-21-2020 10:40 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I misunderstood. My mistake.

Highlighted
Options

03-21-2020 11:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Thank you!

As it happens, I don't have MathScript installed on my version of LabVIEW (I use LabVIEW, not Matlab). But this is an opportunity to help you "learn LabVIEW", so bear with me.

First, look carefully at MathScript line 8. There is, I believe, a "typo" in the formula, which will certainly produce a nonsensical answer, if not an out-right Error.

So how to do this the "LabVIEW" way: use LabVIEW Structures and functions! Here we go:

- Line 2 -- wire Sampling Frequency into the "Reciprocal" Function (on the Numeric Palette). Now the output from this function is 1/(Sampling Frequency", which you can use whereever you need it.
- Line 7 -- Is the word "For" missing here? What are you trying to do? I
__think__what you are doing is running a loop N times (and you know N). Find the For loop on the Structure Palette, and wire Number of Samples to its "N" input. - Look at how "t" is computed. It basically is "Index of For Loop * Reciprocal of Sampling Frequency". Well, the Reciprocal is living on a Wire from Step 1, and the Index is living inside the For loop in the little box with "i" inside it. Bring the Reciprocal Wire into the For loop (notice you will get a "Filled-in Square tunnel" symbol when you do this) and use a Multiply function to multiply this by "i".
- Now complete the computation in MathScript Line 8 (after fixing the Error, of course). You can find some useful Numerical Constants on the Numeric by opening the Mathematics Palette (look in the Palette list) under Elementary, Trigonometric.
- Bring the wire from the output of this computation (after multiplying by Amplitude, brought in, as was Frequency, on a Wire) out the right side of the For Loop. Look at the Output Tunnel -- notice it should
__not__be a filled in Square, but rather a Square with [] (a pair of square brackets, suggesting an Array) inside it. Right-click the outside of this (Indexing) Tunnel and choose "Create Indicator. Now, look at the Indicator on the Front Panel -- it should be a 1-dimensional Array, and should be what you want.

I am uncertain why your MathScript routine gave you a 2D Array, but then I'm not a MathScript user. Try using LabVIEW, and see how easy (and logical) it is.

Bob Schor

Highlighted
Options
Thank you. I will try this out. The reason we are using the Mathscript Structure in Labview is because the textbook had us do it that way. I just asked our instructor and he said whatever way we can solve the issue, he is fine with.

03-21-2020 12:04 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Highlighted
Options

** LabVIEW Champion. It all comes together in GCentral **

03-21-2020 01:51 PM - edited 03-21-2020 01:58 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

remove one of the "t"s from the last line. one is enough!

"x=A*sin(pi*f*t)" *instead of x=A*sin(t*pi*f*t)*

Also please fill controls with typical default data before attaching code so we can run it without having to guess:

Highlighted
Options

03-21-2020 02:00 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@altenbach wrote:

remove one of the "t"s from the last line. one is enough!

"x=A*sin(pi*f*t)"

instead of x=A*sin(t*pi*f*t)

Close, but only half a cigar (there's a clue buried in there ...).

BS

03-21-2020 02:34 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@Bob_Schor wrote:

@altenbach wrote:

remove one of the "t"s from the last line. one is enough!

"x=A*sin(pi*f*t)"

instead of x=A*sin(t*pi*f*t)Close, but only half a cigar (there's a clue buried in there ...).

It gets rid of the error and outputs a 1D array as desired. Data looks like a sine function. Problem solved....

If different math is needed, that's out of my control 😉 I am not providing ashtrays! 😄

(But yes, using plain G instead of mathscript would turn is into a "fewliner".)