LabVIEW

cancel
Showing results for
Did you mean:

Highlighted

Re: Computing the value of sin(x)

Is this now a different "that" or are you still talking about that other thread?

Each term of the expansion can be calculated directly from [I]. All you need is to add them up. Where do you have problems?

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 11 of 26
(944 Views)
Highlighted

Re: Computing the value of sin(x)

I do not know how to correctly set it up that way... I have tried many times but it does not work. I do not know where my problem is

Message 12 of 26
(938 Views)
Highlighted

Re: Computing the value of sin(x)

This is very simple. Part of the problem could be that you have some of your inputs reversed. For example instead of "(-1)^n" you seem to calculate "n^(-1)", which is someting completely different! Also mind your representations. The value wired to N should be an integer (blue). You definitely don't need a formula express VI.

For each iteration you need the following terms based on the iteration number obtained from [i]:

• (-1)^n
• x^(2n+1)
• (2n+1)!

combine them according to the formula and run the loop N times and autoidenx the result at the right loop boundary. After the loop, use "add array elements" to create the sum. You don't even need a shift register.

There are many other ways to do it (e.g. as in the quoted thread), but try this first. Post your code (the actual VI, not pictures!) if you get stuck.

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 13 of 26
(929 Views)
Highlighted

Re: Computing the value of sin(x)

I am trying to do this. But I can't on configure formula. This looks hard to me. Would you kindly provide an example?

Thanks!

Message 14 of 26
(677 Views)
Highlighted

Re: Computing the value of sin(x)

@BArtzon wrote:

I am trying to do this. But I can't on configure formula. This looks hard to me. Would you kindly provide an example?

What is "this" that you are trying to do?

Why are you trying to use a formula node at all and what exactly seems hard to you?

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 15 of 26
(666 Views)
Highlighted

Re: Computing the value of sin(x)

I had to try it for funsies. It's quite impressive how well it hits the target just with n=5.

/Y

"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Message 16 of 26
(659 Views)
Highlighted

Re: Computing the value of sin(x)

@Yamaeda wrote:

I had to try it for funsies. It's quite impressive how well it hits the target just with n=5.

Yes, it is pretty good. In my old post, I claim that with 14 terms we get within 1e-15 of the correct values.

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 17 of 26
(636 Views)
Highlighted

Re: Computing the value of sin(x)

You gave me the solution, but I think I missed something. I am getting the wrong output. Can you check what is wrong? I am new to this.

Message 18 of 26
(617 Views)
Highlighted

Re: Computing the value of sin(x)

did you notice the inversion circle on the lowest input of the middle compound arithmetic node? Right-click the terminal and select invert, resulting in a division. The rest is correct.

You probably also want to remove that wait. Makes no sense to have it there

Btw, my code is posted here. (Also, the above image is a snippet)

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 19 of 26
(613 Views)
Highlighted

Re: Computing the value of sin(x)

Thank you!

I am trying to do the taylor expansion of sinx using the formula node but don't quite understand how to go about defining the factorial. How would you do that?

Message 20 of 26
(569 Views)