I don't know what you have added 1 to the interval here:
y(i)=-pi+(pi-(-pi)+1)*rand;
^^^
why +1 here ???
This should just be:
y(i)=-pi+(pi-(-pi))*rand;
문제
let us consider following article and equation 1
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.30.5925&rep=rep1&type=pdf
what i want is to generate phases uniformly in [-pi pi]interval,let say i need to generate four uniformly distributed phases in this range,i have tried following result
y=zeros(1,4);
for i=1:4
y(i)=-pi+(pi-(-pi)+1)*rand;
end
which gave me following result
2.79219092856020 3.45545787388109 -2.21672413895542 3.51069296177449
but it seems in correct result,so when i have made mistake?please help me
해결책
I don't know what you have added 1 to the interval here:
y(i)=-pi+(pi-(-pi)+1)*rand;
^^^
why +1 here ???
This should just be:
y(i)=-pi+(pi-(-pi))*rand;