Skip to contents

This function generates random noise dimensions to be added to the coordinates of a sphere.

Usage

gen_noise_dims(n, num_noise, min_n, max_n)

Arguments

n

The number of observations for which to generate noise dimensions.

num_noise

The number of noise dimensions to generate.

min_n

The minimum value for the random noise.

max_n

The maximum value for the random noise.

Value

A matrix containing the generated random noise dimensions.

Examples

# Generate random noise dimensions with 3 dimensions, minimum value -1, and maximum value 1
set.seed(20240412)
gen_noise_dims(n = 50, num_noise = 3, min_n = -0.01, max_n = 0.01)
#>                [,1]          [,2]          [,3]
#>  [1,] -0.0081241781  0.0029029013 -9.882231e-03
#>  [2,] -0.0013916432  0.0085220913 -1.908421e-03
#>  [3,]  0.0047922982  0.0008789316 -1.908479e-03
#>  [4,]  0.0028673615 -0.0062801598 -1.132963e-03
#>  [5,]  0.0080366237  0.0010793861 -7.232830e-03
#>  [6,] -0.0061656492  0.0083643541 -2.758769e-03
#>  [7,] -0.0080114199 -0.0062033197  4.553525e-03
#>  [8,]  0.0006888202  0.0076752447  9.725048e-03
#>  [9,] -0.0029419869  0.0079036858 -7.495971e-03
#> [10,] -0.0011790375  0.0097713338 -1.202918e-03
#> [11,]  0.0012250383 -0.0015515248  2.447500e-03
#> [12,]  0.0018398017 -0.0070728049 -3.026401e-03
#> [13,]  0.0087450867 -0.0062946529 -1.394902e-03
#> [14,]  0.0065550766 -0.0069294610  2.396136e-03
#> [15,] -0.0030396846  0.0028311002  8.503313e-03
#> [16,] -0.0019680972  0.0026498845 -3.977120e-03
#> [17,]  0.0035768726  0.0049580126  6.830826e-03
#> [18,]  0.0006256678  0.0088542781  2.780382e-03
#> [19,] -0.0099711034  0.0021352943  8.744064e-04
#> [20,] -0.0085101676 -0.0087703394 -7.252224e-03
#> [21,] -0.0028271391 -0.0032887361 -1.828240e-03
#> [22,] -0.0079838673  0.0043019465  7.502448e-03
#> [23,]  0.0001737718 -0.0017162139 -4.108727e-03
#> [24,]  0.0093835945  0.0050491594  1.934096e-03
#> [25,] -0.0020036394  0.0068283860 -1.484930e-03
#> [26,] -0.0082353506  0.0080715668 -7.904536e-03
#> [27,]  0.0005767927  0.0041543067  2.803204e-03
#> [28,]  0.0086768129 -0.0080712857  2.699075e-05
#> [29,]  0.0038968253 -0.0061933544  7.918596e-03
#> [30,] -0.0031470991 -0.0058318664 -8.436244e-03
#> [31,] -0.0029613733 -0.0047185251 -3.841216e-03
#> [32,]  0.0069886823 -0.0077702175  6.599277e-03
#> [33,]  0.0024468334 -0.0078867235 -8.836028e-03
#> [34,]  0.0080644684  0.0049693606  7.185206e-03
#> [35,] -0.0026684931  0.0094337330 -4.310124e-03
#> [36,]  0.0097486683  0.0071273835 -4.622817e-03
#> [37,] -0.0031669651  0.0079496680 -5.809397e-03
#> [38,]  0.0057971367 -0.0064638016  6.931980e-03
#> [39,] -0.0067298187 -0.0079483790 -4.908143e-03
#> [40,]  0.0069486917  0.0028332293  8.764649e-03
#> [41,] -0.0081894291  0.0058049546  3.807404e-03
#> [42,]  0.0051319804  0.0005169622 -3.146600e-03
#> [43,]  0.0068124540 -0.0014106342  2.722901e-03
#> [44,] -0.0003855060 -0.0007895493 -4.236341e-03
#> [45,]  0.0012020314  0.0072803056 -5.930592e-03
#> [46,]  0.0010315306 -0.0062901867 -7.717957e-03
#> [47,]  0.0081570238  0.0025854880 -2.287048e-03
#> [48,] -0.0017180972 -0.0031161538  7.893594e-03
#> [49,] -0.0027189799  0.0051972852 -7.580571e-03
#> [50,] -0.0016389407 -0.0077337271  1.732173e-03