Please or Register to create posts and topics.

Example for calculating frequencies of sweep measurement values


i want to calculate the associated frequencies to the measurement values of a sweep.
The example "SweepSpectrum" doesn't calculate the frequencies as far as I have understood.
I also know that i have to use the header values of the data packet (startfrequency, spanfrequency, stepfrequency, num and size)
Could you please provide a example calculation like this:

for( int i = i < numSweeps; i++)
float frequencyForCurrentSample = ?

Thank you very much.


Assuming you have a AARTSAAPI_Packet structure named "packet":

int64_t stepSize = packet.spanFrequency / packet.size;
for (int i = 0; i < packet.size; i++) {
frequencies[i] = packet.startFrequency + stepSize * i;

packet.size is the number of values in each sample (a sample consisting of one measurement of the specified frequency range), so also the number of individual frequency points.

packet.num is the number of samples in the packet. However the parameters for all samples in the packet are the same, so you only need to iterate over them when looking at the actual values.

msa has reacted to this post.

Thanks, that's exactly what i've searched for.