# Applications

In this section, the main applications of the User Functions are summarized.
• Calculator
• Plot Viewer
• Geometry Parameters
• Geometry Creation
• FMCW
• Reflectarray Layout

Take the following user functions file that will be used in the following sections. You can copy and paste it into a new user function on your editor if you want to try these by yourself. Press New user function to create a blank file, then write the contents of the user function file, and then press Save to save the file. It will ask you for the name to give to the user function.

 //Returns a random value between 0 and 1
double randomValue() {
return Math.random();
}
//Returns a random value between 'min' and 'max'
double randomValue(double min, double max) {
double size = max - min;
return min + size*Math.random();
}
//Returns an array of random values between 0 and 1
double[] randomArray(int size) {
double [] array = new double[size];
for (int i = 0; i < size; i++){
array[i] = randomValue();
}
return array;
}
//Returns an array of random values between 'min' and 'max'
double[] randomArray(double min, double max, int size) {
double [] array = new double[size];
for (int i = 0; i < size; i++){
array[i] = randomValue(min, max);
}
return array;
}

//Generate linearly spaced vector
double[] linspace(double min, double max, int samples) {
double step = (max-min)/(samples-1);
double[] range = new double[samples];
for(int i=0; i<samples; i++) {
range[i] = min + (step*i);
}
return range;
}
//Return an array with the values of applying the 'sin' operation
//to the input arguments
double[] sinValues(double[] x) {
double[] y = new double[x.length];
for(int i=0; i<y.length; i++) {
y[i] = Math.sin(x[i]);
}
return y;
}