File Exchange
Try Origin for Free
The Origin Forum
Home
|
Profile
|
Register
|
Active Topics
|
Members
|
Search
|
FAQ
|
Send File to Tech support
Username:
Password:
Save Password
Forgot your Password?
|
Admin Options
All Forums
Origin Forum
Origin Forum
sine wave signal generator ?
New Topic
Reply to Topic
Printer Friendly
Author
Topic
fastcloud
Korea
2 Posts
Posted - 06/20/2013 : 08:50:54 AM
Origin Ver.9 (Student) 64bit
Operating System:Windows7 64bit
Hi, I'm new to this forum!
I'd like to make 1D sine wave signal file with given parameters as;
* shuffle 5 known frequencies every 1 second.
* amplitude fixed to given value (min.~max.)
* sampling frequency at 1500 Hz.
* total length of the data is 5 seconds.
Could any guru help me?
Sanghyun
greg
USA
1378 Posts
Posted - 06/20/2013 : 4:57:41 PM
Not sure what shuffle is supposed to do.
How about this...
New Project
Copy and Paste the following to the Command Window and press Enter
// BEGIN SCRIPT
// The setup
double dSPS = 1500; // Samples per second
double dSeconds = 5; // Seconds
string strFreq$ = 30 60 120 240 480; // List of frequencies
min = 38; // Minimum
max = 76; // Maximum
// The script
col(1) = data(0,dSeconds,1/dSPS);
get col(1) -e last;
double dFreq;
int tVal;
loop(ii,1,last)
{
tVal = col(1)[ii];
if(tVal == int(tVal) && tVal < 5)
{
// "shuffle"
string strThisFreq$ = strFreq.GetToken(tval+1)$;
dFreq = %(strThisFreq$);
}
col(2)[ii] = sin(2 * pi * dFreq * col(1)[ii]);
}
frange = max - min;
col(2) *= ( frange / 2);
col(2) += ( frange / 2 + min);
// The Plot
plotxy iy:=(1,2) plot:=200;
// The proof
fft1;
win -a Graph2;
// END SCRIPT
fastcloud
Korea
2 Posts
Posted - 06/20/2013 : 8:17:03 PM
Dear Greg;
Your scrip worked great!
I do appreciate your help.
Best regards,
Sanghyun
Topic
New Topic
Reply to Topic
Printer Friendly
Jump To:
Select Forum
Origin Forum
Origin Viewer Forum
Origin Forum
Origin Forum for Programming
Forum for Python
LabTalk Forum
Forum for Origin C
Forum for Automation Server/COM and LabVIEW
Origin中文论坛
Origin 中文论坛 (Chinese Origin Forum)
Japanese Origin Forum
Origin日本語フォーラム (Japanese Origin Forum)
Origin on Linux
The Origin on Linux Forum
Private Forums
Distributor Forum
--------------------
Home
Active Topics
Frequently Asked Questions
Member Information
Search Page
The Origin Forum
© 2020 Originlab Corporation
Snitz Forums 2000