Changeset - bee157994ef3
[Not reviewed]
default
0 1 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-07-30 15:13:32
hy@ozderya.net
demo mode changed to show fourier components of a square wave instead of a simple sawtooth signal
1 file changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
mainwindow.cpp
Show inline comments
 
@@ -630,6 +630,7 @@ void MainWindow::spsTimerTimeout()
 

	
 
void MainWindow::demoTimerTimeout()
 
{
 
    const double period = 100;
 
    demoCount++;
 
    if (demoCount > 100) demoCount = 0;
 

	
 
@@ -638,7 +639,9 @@ void MainWindow::demoTimerTimeout()
 
        for (unsigned int ci = 0; ci < numOfChannels; ci++)
 
        {
 
            DataArray data(1);
 
            data.replace(0, (ci + 1)*demoCount);
 
            // we are calculating the fourier components of square wave
 
            double value = 4*sin(2*M_PI*double((ci+1)*demoCount)/period)/((2*(ci+1))*M_PI);
 
            data.replace(0, value);
 
            addChannelData(ci, data);
 
        }
 
    }
0 comments (0 inline, 0 general)