Sebastiaan Heunis | 22 Jul 00:04

Spectrogram help

Hi

I've really spent a lot of time trying to get a spectrogram just to
display some simple data.  I had a look at Matthias's code.  I had
trouble compiling that because of Qt/Qwt version differences (I have
Qwt 5.1.1 and Qt 3).  I use Qt 3 because Gnuradio does not work with
Qt 4 yet.  I started writing my own program using Matthias's and the
example spectrogram code.  I know that I am on the right track, but it
doesn't work yet.  Can anyone please have a look at my rough code and
see what I might be doing wrong?

Thank you very much.

plot.h
-------------

#ifndef PLOT_H_

#define PLOT_H_


#include <qwidget.h>
#include <qlayout.h>

#include <qwt_plot.h>

#include <qwt_color_map.h>

#include <qwt_plot_spectrogram.h>

(Continue reading)

David Stranz | 22 Jul 00:58

RE: Spectrogram help

Hello Sebastiaan,

For one thing:

    double value(double x, double y) const

    {

		int xpos = (int)((x - m_RangeX.min) / m_RealToArray.x);

		int ypos = (int)((y - m_RangeY.min) / m_RealToArray.y);

		int pos = ArrPos(xpos, ypos);

		double dvalue = m_Array[pos];

		return dvalue;

    }

This won't work (or probably, it won't do what you are likely
thinking it should do).  At best your image will look like a bunch 
of rectangular blocks since you aren't doing any interpolation.
Th bigger you make your window, the bigger the blocks; make it
smaller than 200 x 300 and blocks start to disappear due to roundoff
in the int() cast.

You must remember that when QwtPlot displays a spectrogram, it
maps the x, y dimensions of the window onto the x, y dimensions
of the data.  In your case, ONLY when the window size is exactly
(Continue reading)


Gmane