lokobob99 Posted September 19, 2022 Share Posted September 19, 2022 Hey everyone, I have a (simple) question: How could you use the SDK functions to generate a sine wave, which is a combination of e.g. 2 different frequencies? So, lets say for example, you have the following code: print("Generating sine wave...") dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_int(1)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcSine) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(12000)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(0.705)) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1)) This generates a sine wave with a frequency of 12000 Hz. Now let's say I want to generate a second sine wave with a frequency of 5000 Hz: print("Generating sine wave...") dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_int(1)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcSine) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(5000)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(0.705)) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1)) Now I would like to add these two sine signals, so that the output signal contains frequency components of 12000 Hz and 5000 Hz. Thanks in advance for any help! PS: My goal with the custom signal is to use the FFT to get the 2 frequency components (5000 and 12000 Hz). Kind regards Link to comment Share on other sites More sharing options...
0 attila Posted September 20, 2022 Share Posted September 20, 2022 Hi @lokobob99 With the ADP3X50 you can apply to the AM/SUM (and FM/phase modulation) options. With any device use custom waveform, generate and add, 5 and 12 periods of sine and run at 1kHz. Link to comment Share on other sites More sharing options...
0 lokobob99 Posted September 20, 2022 Author Share Posted September 20, 2022 Hey attila, thank you for your answer. The problem is that I would like to use the waveforms SDK to generate the signal and not the software. Do you know if this is possible? :) Kind regards Link to comment Share on other sites More sharing options...
0 attila Posted September 20, 2022 Share Posted September 20, 2022 Hi @lokobob99 Yes, see WF SDK/ samples/ py/ AnalogOut_Custom.py Link to comment Share on other sites More sharing options...
Question
lokobob99
Hey everyone,
I have a (simple) question: How could you use the SDK functions to generate a sine wave, which is a combination of e.g. 2 different frequencies? So, lets say for example, you have the following code:
print("Generating sine wave...")
dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_int(1))
dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcSine)
dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(12000))
dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(0.705))
dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1))
This generates a sine wave with a frequency of 12000 Hz. Now let's say I want to generate a second sine wave with a frequency of 5000 Hz:
print("Generating sine wave...")
dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_int(1))
dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcSine)
dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(5000))
dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(0.705))
dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1))
Now I would like to add these two sine signals, so that the output signal contains frequency components of 12000 Hz and 5000 Hz.
Thanks in advance for any help!
PS: My goal with the custom signal is to use the FFT to get the 2 frequency components (5000 and 12000 Hz).
Kind regards
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now