I am trying to place Weibull distributed random numbers in a sector of a circle.
I generated the random number, then distributed it in Weibull distribution. Now I want to use these Weibull distributed random numbers.
RadarSpace GetWeibullClutter()
{
Random _randomNumberGenerator = new Random();
Weibull myweibull = new Weibull(3,2,_randomNumberGenerator);
int n = 50; // number of clutter elements
var maxRange = _detectionModel.MaximumRange;
var centreX = 0; // Centre of the field of view -- X coordinates
var centreY = 0; // Centre of the field of view -- Y coordinates
var minimumAngle = Math.PI / 4; // _detectionModel.MinimumPhi;
var maximumAngle = (3 * Math.PI) / 4; // _detectionModel.MaximumPhir;
var theta = (maximumAngle - minimumAngle) * myweibull + minimumAngle;
var r = maxRange * Math.Sqrt(_randomNumberGenerator.Next(n));
var x = centreX + r * Math.Cos(theta);
var y = centreY + r * Math.Sin(theta);
I want the Weibull distributed random number to be multiplied in the var theta
, but it rather says
operator '*' cannot be applied to opperands of type 'double' and 'weibull'
the updated code is
RadarSpace GetWeibullClutter()
{
Random _randomNumberGenerator = new Random();
Weibull myweibull = new Weibull(3,2,_randomNumberGenerator);
int n = 50; // number of clutter elements
var maxRange = _detectionModel.MaximumRange;
var centreX = 0; // Centre of the field of view -- X coordinates
var centreY = 0; // Centre of the field of view -- Y coordinates
var minimumAngle = Math.PI / 4; // _detectionModel.MinimumPhi;
var maximumAngle = (3 * Math.PI) / 4; // _detectionModel.MaximumPhir;
var theta = 0.0;
var r = 0.0;
var randomNumbers = new double[n];
myweibull.Samples(randomNumbers);
for (int i = 0; i < n; i++)
{
theta = (maximumAngle - minimumAngle) * randomNumbers[i] + minimumAngle;
r = maxRange * Math.Sqrt(randomNumbers[i]);
}
//var theta = (maximumAngle - minimumAngle) * myweibull.Sample() + minimumAngle;
//var r = maxRange * Math.Sqrt(_randomNumberGenerator.Next(n));
var x = centreX + r * Math.Cos(theta);
var y = centreY + r * Math.Sin(theta);