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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Poisson (help needed)

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
pegor Posted - 03/04/2005 : 09:24:42 AM
Origin Version (Select Help-->About Origin): 7.5
Operating System:win xp

Hi all,

I want to generate some random numbers that have poisson distribution.
Cpyang told me before to use the following code (thanks alot for ur help):


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
}


and it worked perfectly, but the problem is that i want to change the mean so many times in the project, so i cant do it by hand each time,and i cant write: ("temp=Poisson(1000, mean)") and give values to mean.

How can i do this?

Thanks in advance,
Pegor
1   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 03/04/2005 : 09:33:30 AM
here is the modified code,


void tt(int nCol = 1, double dMean = 3.0)
{
string strLT;
strLT.Format("temp=Poisson(1000, %f)", dMean);
LT_execute(strLT);// create 1000 points with mean = dMean, 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
}





CP



The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000