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 for Programming
 Forum for Origin C
 random numbers
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

pegor

Germany
Posts

Posted - 02/27/2005 :  09:50:44 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 SR4
Operating System: win xp

Hi,

i want to generate some random numbers that have poisson distribution.
i found this labtalk command:
Poisson(npts, mean, seed)

Does anybody know how can i use this command to generate a random number?

I tried this:

void test()
{
col(1)=Poisson(10, 0, 2);
}

but this is not working.

Thanks in advance

cpyang

USA
1406 Posts

Posted - 02/27/2005 :  12:22:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Here is how you can use the LabTalk function Poisson,

 

void tt(int nCol = 1)
{
LT_execute("temp=Poisson(1000, 3)");// create 1000 points with mean = 3, result in dataset called temp
Worksheet wks = Project.ActiveLayer();
Dataset dtemp("temp");// dataset temp can be accessed in OC like this
Dataset aa(wks,nCol-1);// col(1), col(2) etc as Dataset
aa = dtemp;
LT_execute("del temp");// best to clean up temp dataset
}





Or you can also call the nag_poisson_dist function, which is more involved.

CP


Go to Top of Page

verrallr@a

Canada
44 Posts

Posted - 03/01/2005 :  10:18:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Maybe you got the parameters wrong?

For me, this works:

col(1)=poisson(10,3);

or col(1)=poisson(10,3,2);

Just using what you used, col(1)=poisson(10,0,2); just gave me zeros in col(1).

Richard.
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