trigonometry - how to implement trigonometric expressions using a programming language? -


*expression:      -(sqrt((a0+a1 cos wt +a2 cos 2wt )^2 +(a1sin wt +a2 sin 2wt)^2     - ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ     - sqrt ((1+b1cos wt+b2 cos 2wt)^2 +(b1 sin wt+b2 sin2 wt )^2   *variables:     - a0=.2     - a1=1.2     - a2=a0=.2     - b1=1.6     - b2=.8     - f=32khz 

*question:

  • i supposed use programming language (not matlab) implement exp , observe o/p signal .... how can , language if possible?

in c#, can use system.math, believe has every function need:

  • abs
  • exp
  • sin
  • cos
  • sqrt
  • ... lot of other methods ...

data type depends on accuarcy need, can use decimal data type.

example:

decimal a0 = 0.2; decimal a1 = 1.2;  decimal result = math.cos(a0) * a1 - math.sqrt(a1); 

basically, programming languages have sort of math library, should contain functions.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -