sin
result = sin(x)
Input: x · Output: result
What it is
Standard trigonometric functions, computed elementwise. x is the input angle in radians — a scalar, a Vec of any length, or a Mat/Signal of any shape.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = sin(x) | x scalar, Vec, Mat, or Signalnot documented yet | result — | Returns exactly the same type and shape as x, one trig value per element. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
x = 0 to 9
plot(x, sin(x / 2))
output
· plot: figure 10 (10 points)
from plotting
x = 0 to 9
plot(x, sin(x / 2), "o")
output
· plot: figure 11 (10 points)
from plotting
signal = sin(2 * pi * 10 * (0 to 999) / 1000) + 0.5 * sin(2 * pi * 80 * (0 to 999) / 1000)
v = vmd(signal, 2) # exactly 2 modes
freqs_hz = v.center_freqs .* fs # convert to Hz
from numerics-dsp
k = 0 to 99
t = 0.02 * k + 0.008 * sin(7 * k) # uneven sample times
x = sin(2 * pi * 3 * t) # a 3 Hz sinusoid
power = vanicek(t, x, [1, 3, 5, 8, 12]) # t need not be evenly spaced
from numerics-dsp