【问题标题】:How to obtain the max value of a plot in JULIA?如何获得 JULIA 中绘图的最大值?
【发布时间】:2016-12-11 17:29:21
【问题描述】:

我一直在研究一个项目,我必须获得我在 PlotlyJS 中制作的情节的最大值,我需要获得 .wav 文件的频率并打印与该频率相关的音符。 http://samcarcagno.altervista.org/blog/basic-sound-processing-julia/ 我一直在关注这篇文章,但这只是给了你频率的频谱图。为了获得基频,我改变了 y 的值。

plot(scatter(;x=freqArray/1000, y=p),
Layout(xaxis_title="Frecuencia (kHz)",
        xaxis_zeroline=false,
        xaxis_showline=true,
        xaxis_mirror=true,
        yaxis_title="Intensidad (dB)",
        yaxis_zeroline=false,
        yaxis_showline=true,
        yaxis_mirror=true))

That's the plot 请帮帮我,我不知道如何获取频率

【问题讨论】:

  • maximum(freqArray) 不帮忙?
  • 谈论一个情节的最大值是没有意义的。您需要的是您放入图中的数据的最大值。

标签: plot max julia plotly


【解决方案1】:

你有两个耦合向量。 p 包含强度值,freqArray 包含匹配频率。您的绘图显示由(freqArray[i],p[i]) 为所有索引i 定义的(x,y) 点序列。

您可以使用indmax(p) 返回p 具有最大值的索引。然后,您可以通过在该索引处对freqArray 进行索引来查找频率。

julia> p = rand(200);
       freqArray = 5:5:1000;

julia> idx = indmax(p)
114

julia> p[idx] # this is the maximum value
0.9968329198539723

julia> freqArray[idx] # and this is its frequency
570

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-05
    • 1970-01-01
    • 1970-01-01
    • 2020-04-23
    • 2012-04-10
    • 1970-01-01
    • 2020-03-15
    相关资源
    最近更新 更多