I would like to know whether I can include if, else conditional statements in the Waveform generator (in Analog Discovery) in "Custom" and math tab.
If I select Custom to generate a waveform, in the script editor, Can I use the variable "X" defined in the Math tab (in the "X from 0 to 1.5" fields) ?
I just want to generate waveform with "if", "else" conditional statements.
Example: I wish to have the Sin wave when the X (X goes from 0 to 1.5) variable is between 0.5 and 1 and zero output outside the specified range.
if ( X < 0.5){
Y = 0;}
else if (0.5 <= X <= 1 ){
Y = 0.5*sin(62*PI*X); }
else { Y = 0;}
Please see the attached.
Any suggestions!
I have scripts written in Python. How I can import Python Scripts to generate custom waveforms in Waveform generator?.
Question
jfdo
Hi All,
I would like to know whether I can include if, else conditional statements in the Waveform generator (in Analog Discovery) in "Custom" and math tab.
If I select Custom to generate a waveform, in the script editor, Can I use the variable "X" defined in the Math tab (in the "X from 0 to 1.5" fields) ?
I just want to generate waveform with "if", "else" conditional statements.
Example: I wish to have the Sin wave when the X (X goes from 0 to 1.5) variable is between 0.5 and 1 and zero output outside the specified range.
if ( X < 0.5){
Y = 0;}
else if (0.5 <= X <= 1 ){
Y = 0.5*sin(62*PI*X); }
else { Y = 0;}
Please see the attached.
Any suggestions!
I have scripts written in Python. How I can import Python Scripts to generate custom waveforms in Waveform generator?.
Thank you in adavance.
Fernando
Link to comment
Share on other sites
9 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.