This example shows how to calculate Welch Periodogram by using Julia Script.  


You will have to install DSP package before using this example.


using DSP


function process( input_windows::Array{SigviewWindow}, output_signal::SigviewSignalWindow )


  #use function from DSP package to calculate spectrogram. Many optional parameters are also available

  result = welch_pgram( input_windows[1].samples; fs = input_windows[1].samplingRate )

  #take all calculated value except the first one, for frequency 0Hz (DC)

  output_signal.samples = result.power[2:length(result.power)]

  #"sampling rate" for periodogram is 1/<frequency resolution>. Resolution is equal to the second value in freq. array

  output_signal.samplingRate = 1/result.freq[2]

  #set resulting line color

  output_signal.lineColor = COLOR_ANALYSIS


  return true

end