From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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
(6,696 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! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 26
(6,688 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
(6,675 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.)

0 Kudos
Message 4 of 26
(6,654 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
(6,641 Views)

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

0 Kudos
Message 6 of 26
(6,636 Views)

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

0 Kudos
Message 7 of 26
(6,630 Views)

@waltonj1 wrote:

I read that but it did not help too much.


What is "that"?

0 Kudos
Message 8 of 26
(6,621 Views)
0 Kudos
Message 9 of 26
(6,618 Views)

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

 

Thanks

0 Kudos
Message 10 of 26
(6,614 Views)