Sine wave of only 3 cycles

Dear Sir,

A block of Signal Source (Sine) generates sine wave continuously.
How to make it just generates 3 wave-cycle and then stop generating
immediately.
At the end of the flow-graph there is a File Sink. This captures data
for
offline processing.

Regards,
[email protected]

Hi,

you can use a Head block to make the sample stream stop after a given
number of samples. Just calculate how many samples there will be in
three
cycles and set the Head block’s parameter accordingly.

Greetings
Felix

2014-01-30 Activecat [email protected]:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Also,
to do basic mathematical tasks you don’t have to rely on GNU Radio,
which is a fine signal processing framework but not so much a math
environment.

If you want to have a three period sine signal, the python is short

#import numpy as np

f_sin = 1.0
f_sample = 16.0
periods = 3.0

s_per_period = f_sample/f_sin

sinevalues = np.sin(np.linspace(0, periods2np.pi,
periods*s_per_period) )
sinevalues.astype(np.float32).tofile(“filename”)

this will be the same data format as written by the file sink.

Greetings
Marcus
On 30.01.2014 13:02, Felix W. wrote:

_______________________________________________ Discuss-gnuradio

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS6kMXAAoJEAFxB7BbsDrLvCsH/RT3cjGEe+/F/xZKATXhcT/N
KXTcGJlR3otmGA3EUU79IF7Veel9LFBlhUXIU1OhCPn3n8QpAS0KBzTW5cBatHDb
HsD+IRZcYN3GkpqYXwpCtaLMNJgDKuHpPXxVwg3CMOXFB6LrJ8eZmB18TGplPv0x
+N/ijjpRXyFOUwMMyC+vQbGGWkYfEFF3tlwf7Wnt9B5E8+cevVDoTOo4/zGfInv8
n6Ww57l7/uxRncBN+eiKdjShWhVD9xKYkonghvJJ05TBRyy4D5IODQJqo8iZlcgA
0Q6DHZAPiBgr5rTzbAenHx48RIls7j6+HSEtMDXrHkfRrdOuYxZDgMAh8rDXXgo=
=j9iF
-----END PGP SIGNATURE-----