Is there any further steps to calculate phase after dft? [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am trying to find magnitude and phase of fourier transform. There is an tutorial Opencv.
After using this formula, we are going to switch to a logarithmic scale and shifting normalizing. But I could not find for phase. Phase formule is :
Here is the question after arctan calculation, do I need to do extra stuff like magnitude(log scale,shifting,normalizing)? Or what is the logic behind it I could not understand? I am programmer guy and I am very far from these Math stuff.

The arctan range is (−π, π]. Hint: use std::atan2. You may indeed shift this to [0, 2*π) if you like. This is in no way necessary, it just avoids negative numbers.
Scaling to 360 degrees is also possible, but very rare - math is always done in radians, degrees are only for human consumption, and which human is going to look at FFT magnitudes?
Log scales are utterly pointless for angles, as they are modulo 2π.

Related

Solving a modular exponentiation with unknown power [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Guys I what is the fastest algorithm to solve a modular equation in the format of a^b = c mod p where p is a really big prime and b is unknown.
e.g.:
2^k = 15 mod 30903154482632612361920641803533
I already tried trial and error using boost library in C++ but it would take very long time to reach the answer.
You're trying to solve what is called a discrete logarithm. If there was an efficient solution to this, I imagine whoever discovered it would wreak chaos on cryptographic systems long before it would be posted here.
You will find quite a couple of algorithms on Wikipedia with varying time complexity. Some of these are quite easy to implement. See The computational complexity of discrete log for the best space complexity.

Calculating a coordinate from 2 given 1-dimensional lines [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What is the and optimal method, if not the best, for doing it?
Assume that I have an object that has 2 wheels. The only information I have available is how far the wheels have rolled at any time.
Basically, I want to know how to calculate the coordinates (x2,y2)
I put this question on the programming section because I want to solve this with an algorithm or plainly put, by programming (in c++).
Given that you have how far the wheels have rolled at any time, it means that you have two functions of time w1(t) w2(t) giving the distance covered by the wheels.
from that you may by derivation get the scalar velocity of each wheel as v1(t) and v2(t).
As your object position is the mean between the position of those two wheels, the velocity of your object is the mean of those two velocities, but the difference of the velocities gives the speed of rotation of the object. So you have essentially a velocity described as a scalar velocity plus a rotation speed.
By integrating that vectorial quantity you may arrive to the current position of your object.
Details must be thought carefully, but the idea I think is that.

Interpolation of geographical coordinates c++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm searching for solution of my problem.
I have some geographical coordinates like this:
Lat. 32.5327 Lon. 95.5019 time 15:44:44
Lat. 32.5339 Lon. 96.1439 time 15:48:31
It's position of some object and time when it was in that position.
What i need is to check in some interval of time(30 seconds for example), what was the position of the object between these points.
Interpolating over a sphere and finding the shortest path between two points would require for example Slerp.
But for distances less than 100km you will end up with a line (more or less) so do not bother and do a linear interpolation.
As #chux pointed out: linear interpolation will exibit significant artifacts when interpolating near the poles.

C++ comparing two value to find which is closest to user input value [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have been looking on the internets for a while to find a solution to my problem. First some back ground. I'm writing a program that calculates catapult trajectory. The user must first type in a distance. Then I loop through the combinations of angle degrees and velocity to find which combination will give a distance that will come the closest to the users input. I don't quite know how to do the variable comparison to find which combination of degrees and velocity produces a distance closest to a users input of distance. I'm just trying to keep it simple and easy as possible. Also, I'm not using any kind of array to store the values. I want it done on the fly inside my for loops if possible. Any suggestions?
Well, the answer to this depends on the complexity of your trajectory formula. I'm guessing that you're not taking fluid dynamics or gravity differentials into consideration. In fact, what I imagine is that you're using a basic parabolic equation...
That equation can be solved directly by rearranging. But the thing is, you're solving for two variables that are actually co-dependent. There are infinite solutions if you allow both angle and velocity to vary, so you need to restrict the 'best' answer by some criteria (for example, desired angle or desired velocity).
If you have more variables, like lift, drag, spin, incident shape, non-constant gravity, air pressure and humidity, then you will need to employ a minimization algorithm which is non-trivial. One of the most basic, but a little unstable, is the Nelder-Mead algorithm.
If this has not been helpful enough, you should provide more information about your problem, and show some code.

Normalizing histograms? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
What is normalizing histograms? When and why would I use it? What are its advantages?
I don't understand the concept at all- when I try to apply it to my histogram, when I use back projection, I don't get any results.
Could someone give me a non-technical explanation of normalization?
I am using OpenCV
PS: Don't send me to wikipedia- I don't understand the Wikipedia Page
Thanks
It's very simple, actually. A normalized histogram is one in which the sum of the frequencies is exactly 1. Therefore, if you express each frequency as a percentage of the total, you get a normalized histogram.
What is the use of a normalized histogram? Well, if you studied probability and/or statistics, you might know that one property required for a function to be a probability distribution for a random variable is that the total area under the curve is 1. That's for continuous-variable functions. For discrete functions, the requirements is that the sum of all values of the function is 1. So a normalized histogram can be thought of a probability distribution function which shows how probable each of the values of your random variable is.