[EDIT: 20110628 00:13 CDT – reformat – WDR]
i have code and i would like to make some changes and add 2 conditions for these 3 random variables (c, gama, fi). i want to limit each of them in a specific zone and check the random number which is generated in every loop to not be duplicated also not be out of range.
these are conditions:
- 2.7< fi <16.3
- 450< c <800
- 1.92< gama <1.98
and each of them must be check to not be repeating in every loop.
this is my code :
clear;clcB=1000;L=2000;Sc=1.1;Sq=1.1;Sgama=.8;nsamples=10000; for i=1:nsamples C=normrnd(620,147.64); gama=normrnd(1.96,0.02); fi=normrnd(3.76,1.1034); Nq=tan((pi/4)+(pi*fi/360))*tan((pi/4)+(pi*fi/360))*2.718^(pi*tan(fi*pi/180)); Nc=(Nq-1)*cot(fi*pi/180); Ngama=2*(Nq+1)*tan(fi*pi/180); qult(i)=(C*Nc*Sc)+(384*Nq*Sq)+(980*Ngama*Sgama); end
Best Answer