LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

to display sinx in radians

Same as in my code above, you don't need the factorial function. It is just a series of multiplications. Since you need 50% of the intermediary results anyway, using a native factorial function would lead to a lot of unecessary duplicate computations.

 

Both mathscript and the formula node support loops, and that's all you need to e.g. translate my code above into text.

 

Of course I see absolutely no reason to do this "in text" if a good plain LabVIEW implementation exists, unless this is an exercise or homework.

 

Since your only concern was the absence of the factorial function in the formula node, and I just told you that you actually don't need it, maybe you can figure all this out by yourself. Once you have a solution, please post it. 😄

0 Kudos
Message 11 of 24
(1,837 Views)

@altenbach wrote:

Same as in my code above, you don't need the factorial function. It is just a series of multiplications. Since you need 50% of the intermediary results anyway, using a native factorial function would lead to a lot of unecessary duplicate computations.

 

Both mathscript and the formula node support loops, and that's all you need to e.g. translate my code above into text.

 

Of course I see absolutely no reason to do this "in text" if a good plain LabVIEW implementation exists, unless this is an exercise or homework.

 

Since your only concern was the absence of the factorial function in the formula node, and I just told you that you actually don't need it, maybe you can figure all this out by yourself. Once you have a solution, please post it. 😄


My answer is not matching with your code..Can u please tell me where does the error lies

0 Kudos
Message 12 of 24
(1,826 Views)
  • You seem to be creating a complex output value, coerced to a DBL indicator. Why?
  • I don't see where you divide by the factorial. (Please resize the node so we can actually see everything, or at least show the scrollbars so we can see that there is more!).
0 Kudos
Message 13 of 24
(1,818 Views)

Look this is waht i have written in the Mathscript editor.

"y=0
for i=0:1:n
y=y+(((-1)^n)*(x^(2*n+1))/(factorial(2*n+1)))
end
"

as you can see in the expression i have divided it by  the factorial

 

I am sorry to say that I didnt get the meaning of ur first line

  • You seem to be creating a complex output value, coerced to a DBL indicator. Why?
0 Kudos
Message 14 of 24
(1,813 Views)

Your Y output is of complex (CDB) datatype. Notice the red coercion dot? You need to make N an integer to avoid that.

0 Kudos
Message 15 of 24
(1,806 Views)

@altenbach wrote:

Your Y output is of complex (CDB) datatype. Notice the red coercion dot? You need to make N an integer to avoid that.


Hi

I am novice to this Labview., so its bit difficult for me to understand.. I didnt get what do you mean actually.
n is already accepting integer values only, den what is the problem

0 Kudos
Message 16 of 24
(1,794 Views)

Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.

0 Kudos
Message 17 of 24
(1,792 Views)

@altenbach wrote:

Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.


I have done that but still its far  from the desired reult.

Suppose i take n=5 and x=.7853(pi/4) then the o/p should be 1/sqrt(2) i.e is 0.707 but its differet here.


 

0 Kudos
Message 18 of 24
(1,789 Views)

Anu body please help me with this piece of code...


@TarunAgarwal wrote:

@altenbach wrote:

Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.


I have done that but still its far  from the desired reult.

Suppose i take n=5 and x=.7853(pi/4) then the o/p should be 1/sqrt(2) i.e is 0.707 but its differet here.


 



@TarunAgarwal wrote:

@altenbach wrote:

Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.


I have done that but still its far  from the desired reult.

Suppose i take n=5 and x=.7853(pi/4) then the o/p should be 1/sqrt(2) i.e is 0.707 but its differet here.


 



@TarunAgarwal wrote:

@altenbach wrote:

Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.


I have done that but still its far  from the desired reult.

Suppose i take n=5 and x=.7853(pi/4) then the o/p should be 1/sqrt(2) i.e is 0.707 but its differet here.


 



@TarunAgarwal wrote:

@altenbach wrote:

Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.


I have done that but still its far  from the desired reult.

Suppose i take n=5 and x=.7853(pi/4) then the o/p should be 1/sqrt(2) i.e is 0.707 but its differet here.


 






0 Kudos
Message 19 of 24
(1,765 Views)

Your post seems a bit redundant 😮

0 Kudos
Message 20 of 24
(1,755 Views)