Bug 164466

Summary: The Peak of the Kst Amplitude Spectrum is lower than the Amplitude Spectrum in Octave
Product: [Applications] kst Reporter: Yiwen Mao <yiwenv>
Component: generalAssignee: kst
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: This kst file has the plot of the amplitude spectrum described in bug report
The resulting amplitude spectrum from the Octave
the mfile used to plot the amplitude spectrum in octave
kst file of the simpler case

Description Yiwen Mao 2008-06-19 19:51:56 UTC
Version:           1.7.0 (using KDE 4.0.1)
Installed from:    Unspecified
Compiler:          Fedora 6 
OS:                Linux

Problem: Use both Octave and Kst to plot the amplitude spectrum of the following function
f=(sin(5*pi*t)).^4+(cos(5*pi*t)).^5,where t ranges from 0 to 3

In Kst, the spectrum is set up as shown below:
The FFT length is 2^7
The sample rate is 265.99
The resulting spectrum is not viewed by an apodization function.
The mean is not removed

In Octave, the following is calculated before plotting the spectrum:
N=2^7;
t=linspace(0,3,N); %t is a vector with N linearly spaced elements between 0 and 3
Ts=t(2)-t(s); %sampling period
Ws=2*pi/Ts; %sampling rate = 265.99
W=Ws*(-N/2:(N/2)-1)/N; %frequecny vector
Comment 1 Yiwen Mao 2008-06-19 19:56:23 UTC
Created attachment 25459 [details]
This kst file has the plot of the amplitude spectrum described in bug report
Comment 2 Yiwen Mao 2008-06-19 19:58:11 UTC
Created attachment 25460 [details]
The resulting amplitude spectrum from the Octave
Comment 3 Yiwen Mao 2008-06-19 20:06:43 UTC
Created attachment 25462 [details]
the mfile used to plot the amplitude spectrum in octave
Comment 4 Andrew Walker 2008-06-19 21:09:41 UTC
Created attachment 25464 [details]
kst file of the simpler case

The attached uses a simple 2*cos(t) function for about 8 cycles to calculate
the amplitude spectrum. Kst identifies the single peak in the amplitude
spectrum as 2.0
Comment 5 Andrew Walker 2008-06-19 23:12:20 UTC
The Kst values look okay.