小编Hei*_*tor的帖子

如何在 Julia 中可视化信号的 FFT?

我正在尝试在 Julia 中可视化一个信号及其频谱。

我找到了为频率提供 FFT 和DSPFFTW包。

这是我正在尝试的正弦信号:

using Plots
using FFTW
using DSP

# Number of points
N = 2^14 - 1
# Sample rate
fs = 1 / (1.1 * N)
# Start time
t0 = 0
tmax = t0 + N * fs

# time coordinate
t = [t0:fs:tmax;]

# signal
signal = sin.(2? * 60 * t)  # sin (2? f t)

# Fourier Transform of it
F = fft(signal)
freqs = fftfreq(length(t), …
Run Code Online (Sandbox Code Playgroud)

fft fftw julia

6
推荐指数
1
解决办法
6323
查看次数

选择列具有最小值的 Pandas 数据框行

我试图在 Pandas DatFrame 中选择一行,其中一列的值最低。应该有一个简单的方法来做到这一点,但到目前为止我还没有找到。

假设这个数据框:

>>> print(df.head())
    N   M  S
0  10  42  4
1  39  22  2
2  11  52  4
3  97  42  2
4  66  72  1

Run Code Online (Sandbox Code Playgroud)

如何获取列具有最小值的行?例如,如何获取“S”列的值为 1 的行?

python dataframe pandas

3
推荐指数
2
解决办法
2401
查看次数

没有优化的gcc段错误

以下代码编译但在未使用GCC优化时给出分段错误:

#include <stdio.h>

#define n 10000000

int main()
{
    fprintf(stderr, "Array with size %ld\n", n * sizeof(double));
    double a[n];
    return 0;
}

$ gcc -O0 a.c && ./a.out 
Segmentation fault (core dumped)
$ gcc -O1 a.c && ./a.out 
Array with size 80000000
Run Code Online (Sandbox Code Playgroud)

我用-O1,-O2,-O3测试,甚至用-Og也可以.但是-O0就是段错误.我正在使用GCC 5.3.0.

如果我删除了fprintf,或者我将数组更改为静态double [N],则没有分段错误.

为什么?怎么了?

c gcc

1
推荐指数
2
解决办法
353
查看次数

标签 统计

c ×1

dataframe ×1

fft ×1

fftw ×1

gcc ×1

julia ×1

pandas ×1

python ×1