LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Computing the value of sin(x)

I have a lab that I have been working on and just cannot figure out. If anyone had any input it would be greatly appreciated.

 

The lab is to: Develop a VI that computes the value of sin(x) at a given x using n terms of the series expansion of the sine function.

 

-Create a control which represents the value of n in the sin(x) equation

-Create an indicator to show the result of sin(x)

 

I have been playing around with loops and cannot figure it out.

 

Thanks

0 Kudos
Message 1 of 26
(2,771 Views)

The series expansion is a number of x-exponents and factors, right? According to your instruction you should use N of those.

 

So, make a list of the exponents and factors (actually you only need the factors), loop through them with N as loop counter and x^i * factor, sum up the result.

 

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 26
(2,763 Views)

Also, post the code you have. We will guide you, but not do the work entirely. 😉

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 26
(2,750 Views)

As a first step, find the taylor series expansion for sin(x). Do you have that?


@waltonj1 wrote:

I have been playing around with loops and cannot figure it out.


All you probably need is a single loop, not loops. Show us what you have and we can probably point you in the right direction.

 

(If you would have searched the forum, you probably would have found some interesting discussions, such as this one.)


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 4 of 26
(2,729 Views)

I read that but it did not help too much. Heres the series expansion

 

\sin x = \sum^{\infty}_{n=0} \frac{(-1)^n}{(2n+1)!} x^{2n+1} = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots\quad\text{ for all } x\!

 

Here is the problem (#2)

 

IMG_8599.jpg

 

Here's what I have now. Please ignore the formula I have in the loop, I believe it is wrong...

 

 

 pic.png

0 Kudos
Message 5 of 26
(2,716 Views)
Highlighted

I see that the proper capitalization of LabVIEW is not being taught these days....Smiley Mad

0 Kudos
Message 6 of 26
(2,711 Views)

I always do the proper capitlization myself! You can see by the name of the file 🙂

0 Kudos
Message 7 of 26
(2,705 Views)

@waltonj1 wrote:

I read that but it did not help too much.


What is "that"?


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 8 of 26
(2,696 Views)
0 Kudos
Message 9 of 26
(2,693 Views)

How exactly do I go about that? Sorry...new

 

Thanks

0 Kudos
Message 10 of 26
(2,689 Views)