Questions tagged [trigonometry]
Trigonometry is a branch of mathematics that studies triangles and the relationships between their sides and the angles between sides
trigonometry
3,435
questions
1
vote
1
answer
84
views
Incorrect calculation of a math expression using sin and cos in C?
Why does this simple program
#include <stdio.h>
#include <math.h>
int main()
{
int res = (int)(-1 * sin(M_PI/2) + 1 * cos(M_PI/2));
printf("-1 * %f + 1 * %f = %d\n", sin(...
0
votes
0
answers
74
views
Perfect interpolation (sinc) of Fourier spectrum equivalent to zero-padding time domain
I need to up-sample a 2D Fourier spectrum, this can be done by zero padding the image before the FFT. But in my particular case I cannot perform an FFT or IFFT, the interpolation must be performed in ...
0
votes
1
answer
36
views
Regenerate sound from spectrum analysis
I am trying to code in Python a tool that allows me to regenerate a sound from the spectrum analysis done with Audacity.
I record a sound and do the spectrum analysis which I export to a text file.
...
0
votes
0
answers
40
views
Python code to findan unknown position in a 2D grid using the Snellius Pothenot (3-point) method
How can I calculate the unknown position of my camera placed in a 2D grid, given the known x,y coordinates of 3 fixed reference points and the 2 measured angles
from the camera position? This seems to ...
-3
votes
1
answer
34
views
Get theta based on known hypotenuse and adjacent [closed]
I'm finally trying to understand trigonometry and came across this random quiz question:
As you can see, I got this wrong. I'm having a hard time understanding why. Based on what I know we have:
A ...
1
vote
1
answer
31
views
Finding polygon (sector) in a set that contains given point
I'm making a game engine where levels are sector based, sort of like in Doom or Duke Nukem 3D. I need to find a sector that contains needed point.
I thinked about going through all sectors in map and ...
0
votes
1
answer
99
views
How can I accurately calculate the height of a firework from a video with some known parameters? [closed]
I have a video of some fireworks from my iPhone 13 pro ultra wide angle camera. I want to overlay an accurate grid of heights in the video. Something like a line every 10 meters. Here are the known ...
-1
votes
2
answers
99
views
Calculate position of point along edge of regular polygon?
Say I have a pentagon (and we number the sides, like moving around a clock):
Starting from the center of the polygon, how do you compute the position of a point in these spots (along the line of the ...
-3
votes
1
answer
88
views
How to get the max "width" of a regular polygon in JavaScript?
I have been playing with math equations to draw "regular" polygons (polygons with same length sides and angles). I haven't quite been able to get it to work such that, given a desired width ...
0
votes
1
answer
33
views
Mathematical Expression
How can I write -r² in anaconda environment?
I tried:
-1 * r**2
-1 * (r**2)
(-1) * (r**2)
None of these worked.
What do you think is the problem?
0
votes
0
answers
36
views
How can I change the frequency of a sine wave from a look-up table
I've set an ISR to calculate the sine value for every index of the table up to 200 (the length of the array), then the calculated value is offset by multiplying half the period register then adding ...
0
votes
0
answers
36
views
Cos results in Fortran and MATLAB are different [duplicate]
When I calculate cos(pi/2), MATLAB and Fortran give two different results.
In MATLAB, I just input:
ans =
6.1232e-17
In Fortran:
program cal_cos
implicit none
real*8, parameter :: pi = 3....
1
vote
0
answers
38
views
Arcsine Cordic Implementation using a lookup table
import math
import numpy as np
import matplotlib.pyplot as plt
# Define constants
K = 0.6072529350088813 # K value for CORDIC
NUM_ITERATIONS = 10 # Number of iterations for CORDIC
bitw = 15
# ...
0
votes
0
answers
36
views
Cordic Cosine function for AOA estimation. I get the PDOA estimation in terms of degree and would want to find the cosine and arcsine for the AOA
from math import atan, pi
import numpy as np
def cosine_fun(input):
k = 1.646
bitw = 15
inpLUK = np.zeros(bitw + 1)
x = 1/k
y = 0
z = 0
for j in range(bitw):
tmp =...
0
votes
0
answers
17
views
404 error when accessing IBM Cloud Object Storage from Java
I currently am having trouble to access my Object Storage Bucket from a localhost Java springboot application. I am initializing the session, but when I reach the line
System.out.println(cos....