Skip to content

Commit

Permalink
fft fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dancixx committed Jul 25, 2022
1 parent aa78bfc commit 9f657b6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/fft/dft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const dft = (data: number[]): Complex[] => {
for (let k = 0; k < N; k++) {
const coeff: Complex = [
Math.cos((2 * Math.PI * n * k) / N),
-Math.sin((-2 * Math.PI * n * k) / N),
-Math.sin((2 * Math.PI * n * k) / N),
];

X[n] = add(X[n], multiply(coeff, [data[k], 0] as unknown as Complex));
Expand All @@ -32,3 +32,5 @@ const dft = (data: number[]): Complex[] => {
};

export default dft;

console.log(dft([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]));

1 comment on commit 9f657b6

@vercel
Copy link

@vercel vercel bot commented on 9f657b6 Jul 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

stochastic-js-docs – ./

stochastic-js-docs-git-main-dancixx.vercel.app
stochastic-js-docs-dancixx.vercel.app
stochastic-js-docs.vercel.app

Please sign in to comment.