The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Apr 26th, 2024, 2:53am
Pages: 1
Send Topic Print
$dist_normal (Read 6519 times)
fullstop
New Member
*
Offline



Posts: 3

$dist_normal
May 24th, 2014, 2:54pm
 
Hi ,
I am trying to generate random  number normally distributed at every  time stamp of my transient simulations. this is module I am using.

`include "constants.vams"
`include "disciplines.vams"

module distcheck (pinout) ;
electrical pinout ;
integer seed ;
real rrandnum,counter=0.0 ;
analog begin
@ (initial_step) begin
seed = 0 ;
end
counter=counter+1;
rrandnum = abs($dist_normal( seed,0,1)) ;
V(pinout) <+ rrandnum;
end // of analog block
endmodule

but when i check the output it is giving me weibull and not normal distribution,

can anybody please help me on this

thanks a lot in advance
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: $dist_normal
Reply #1 - May 26th, 2014, 5:14am
 
Fullstop,
Code:
rrandnum = abs($dist_normal( seed,0,1)) ; 

will NOT generate a normal distribution.
- B O E
Back to top
 
 
View Profile   IP Logged
fullstop
New Member
*
Offline



Posts: 3

Re: $dist_normal
Reply #2 - May 26th, 2014, 6:39am
 
Hi BOE,

thanks for the reply.
Can you please help me how that can be done. I want to generate a random number for every time step of my transient simulation.

Thanks
fullstiop
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: $dist_normal
Reply #3 - May 26th, 2014, 7:07am
 
Fullstop,
First of all, taking the absolute value is definitely wrong. I suggest
Code:
rrandnum = $rdist_normal(seed, 0, 1); 


- B O E
Back to top
 
 
View Profile   IP Logged
fullstop
New Member
*
Offline



Posts: 3

Re: $dist_normal
Reply #4 - May 26th, 2014, 7:36am
 
Hey BOE,

Thanks a lot, infact that was the problem.
There is one more issue.
I think it is generating a new random number at every iteration at every time stamp. Isn't it possible like it only generate a random number only when time stamp is increased and not at every iteration during transient simulation. It is taking a lot of time

thanks
fullstop
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: $dist_normal
Reply #5 - Jul 8th, 2014, 7:58am
 
Perhaps that's a bug in your simulator?

You may be able to print the value with
 $debug("rrandnum=%g at time=%g\n", rrandnum, $abstime);

and see if you get different values at the same time.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.