Adding a Constant
Modules:
- add_const_cc()
- add_const_ff()
- add_const_ii()
- add_const_sf()
- add_const_ss()
for complex, floating point, integer, short+short->float and short.
Example usage:
adjust = add_const_ff(25.25)
Instantiates a module to add a constant 25.25 to a signal.
Example:
sampling_freq = 8e6
fg = gr.flow_graph ()
src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 396.15e3, 1, 10)
normal = gr.add_const_ff(-10)
dst_offset = gr.file_sink (gr.sizeof_float, "offset")
dst_normal = gr.file_sink (gr.sizeof_float, "normal")
fg.connect ( src0, dst_offset )
fg.connect ( src0, normal )
fg.connect ( normal, dst_normal )
This creates a signal of 396.15Khz with an ampitude of 1 and and offset of 10,
and writes it to a disk file, "offset". It is also connected to a constant adder which adds
-10 and then written to another disk file, "normal". The results, "offset":
and the file "normal":