The Origin Forum
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 Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

fastcloud

Korea
2 Posts

Posted - 06/20/2013 :  08:50:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

fastcloud

Korea
2 Posts

Posted - 06/20/2013 :  8:17:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Greg;

Your scrip worked great!
I do appreciate your help.

Best regards,

Sanghyun
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000