Skip to contents

This function generates a torus-shaped dataset along with optional noise.

Usage

torus_3d(n, num_noise, min_n, max_n)

Arguments

n

Total number of data points to generate.

num_noise

Number of additional noise dimensions to add to the data.

min_n

Minimum value for the noise added to the data.

max_n

Maximum value for the noise added to the data.

Value

A matrix containing the generated torus-shaped data points with or without added noise.

Examples

set.seed(20240412)
torus_3d(n = 100, num_noise = 2, min_n = -0.05, max_n = 0.05)
#>            [,1]        [,2]         [,3]         [,4]          [,5]
#> out  0.90951920 -0.60806107 -0.423402332  0.046811273 -0.0397026339
#> elt -0.08991944  1.37608857  0.783829026 -0.012496258  0.0290763175
#> elt  1.92353899  1.36399767 -0.933694924 -0.039036306  0.0422360181
#> elt  0.83003839 -0.59852019  0.214714262  0.012114244 -0.0214310022
#> elt -0.64328797 -0.85230208 -0.361993519 -0.007777032 -0.0499433291
#> elt -1.07740800  0.43641026  0.546342158 -0.043311664 -0.0356851794
#> elt  2.27991016  0.94849529  0.883018221  0.009618158  0.0015637302
#> elt -0.68459612 -0.96740243 -0.579647433  0.040446538 -0.0123396746
#> elt -0.44066721  0.91907265  0.195296091 -0.049745073 -0.0284339315
#> elt  2.89233295 -0.02625773 -0.451142082 -0.015265306 -0.0350829806
#> elt -1.77013063 -2.17725247 -0.591877980  0.036571148 -0.0353439124
#> elt -2.97686698  0.16267482  0.192441454  0.015919120  0.0423142502
#> elt -2.30396469 -1.67795640 -0.526417071 -0.031443569 -0.0051962465
#> elt -2.86711352  0.52529668  0.403822613  0.044940477 -0.0389469245
#> elt -0.49260368  1.36398943 -0.835306661 -0.028938895 -0.0086575911
#> elt -1.54463353 -2.07264114  0.811101781  0.013595432  0.0232040592
#> elt -2.02761009  1.96098328  0.571280516  0.002368991 -0.0245691278
#> elt -2.00402888 -2.22826939  0.078876177 -0.030572272 -0.0315889175
#> elt -1.22407299 -1.88529399  0.968806473 -0.018436977  0.0227344875
#> elt  1.33131560 -2.20375109  0.818385989  0.045953311 -0.0366494890
#> elt  1.72001191 -1.09958228  0.999140538  0.034806118  0.0157848667
#> elt  0.54307519  0.84839423 -0.120814417  0.004200594  0.0070135517
#> elt -0.97792502  0.38791002  0.318422494 -0.030929957  0.0208199039
#> elt  0.95601211  0.62496716 -0.513926816 -0.023326323 -0.0189224581
#> elt -0.74198663 -0.85180408 -0.492437719  0.038856192  0.0338216087
#> elt -1.77175118 -2.28843176 -0.447795853  0.036005257 -0.0460992394
#> elt -2.30083104 -0.65197046  0.920212197 -0.005547783  0.0447378346
#> elt -2.70737514 -0.95495518 -0.491536569  0.010797826  0.0272497393
#> elt  1.01314292  2.55113040 -0.667125509  0.029635492 -0.0160971409
#> elt  2.37055274 -1.83439665 -0.071775824  0.009967849  0.0464448324
#> elt -2.30262724  1.22059095  0.795362536 -0.006457079  0.0179349351
#> elt  1.01659347  2.36007814  0.821842883 -0.030954550 -0.0207382537
#> elt -0.83580668 -1.03065600 -0.739606682 -0.025088984  0.0037443788
#> elt -0.03872579 -2.93566285 -0.352217275  0.031934072 -0.0118583800
#> elt -2.29220660 -1.81908089  0.376772240 -0.035403466  0.0063740385
#> elt -0.91276612  1.53101233 -0.976049974 -0.042859625 -0.0297865495
#> elt -1.72952833  1.03476726 -0.999880746 -0.034428535 -0.0433482581
#> elt  1.53330562 -2.36913681 -0.569448787  0.034162961 -0.0163532625
#> elt -0.74096005 -2.72296339  0.569521392 -0.045406635  0.0359919606
#> elt  0.82697717  2.10151405  0.966045000  0.012260502 -0.0370901504
#> elt -0.24414201  2.75371405  0.644605254  0.002252682 -0.0496382012
#> elt  1.56760255  1.22646358 -0.999953674  0.004865140  0.0114451926
#> elt  2.57833755 -0.46358197 -0.784853142  0.037104514 -0.0157686300
#> elt  1.95413931 -1.46752808  0.896111606  0.019189041 -0.0482725061
#> elt  1.09567189  0.82352660 -0.777125394  0.016947191  0.0417446218
#> elt  0.25348964 -0.98093565 -0.161695456  0.023474528  0.0490760001
#> elt -0.93104859  0.44192346  0.245508504 -0.046460505 -0.0143416769
#> elt  1.57224754 -1.80576569  0.918974650 -0.014047195 -0.0389693632
#> elt -0.99198238 -1.04674944  0.829922404 -0.002774406 -0.0050521928
#> elt  0.17077138 -2.75178207  0.653326955  0.021978159 -0.0338490285
#> elt  1.17360555 -0.04344122 -0.564269394  0.001459893  0.0007207744
#> elt -0.87732561 -0.59965247 -0.348462901 -0.032680244  0.0358561296
#> elt  0.87291423 -1.03328620 -0.762192123 -0.006952650 -0.0343432767
#> elt -0.41889290  2.96684558  0.086271361  0.049056897  0.0380912595
#> elt  0.75604245 -0.75795875 -0.368976740 -0.037429136 -0.0017651984
#> elt -1.01975695  0.98666147 -0.813864335  0.040186682  0.0271230818
#> elt -1.15017686 -0.53898403  0.683661775  0.037823953 -0.0153674109
#> elt  1.50138800  0.76302784 -0.948810736 -0.013801423 -0.0435791666
#> elt  0.73863510  1.13936198  0.766570036  0.014180800 -0.0007038843
#> elt -2.55062055  0.71883590 -0.759951924  0.016110678 -0.0042624283
#> elt -2.27318356 -1.47105629  0.706562846  0.045699345  0.0307058573
#> elt -0.32582179 -1.13307184  0.570910285 -0.017281139 -0.0172181919
#> elt -2.49279489 -1.25531207 -0.611780532 -0.022220930  0.0344564827
#> elt -0.63667106  0.77118212  0.008479292  0.048801365 -0.0145525717
#> elt  2.28729702  1.75290343 -0.471744562  0.007458667  0.0024064121
#> elt -0.88356971 -2.31892603  0.876416079 -0.033425671  0.0470545179
#> elt  2.45969599 -0.94180030  0.773467457 -0.035560294 -0.0429631366
#> elt -0.40465479 -1.83775855 -0.992987618  0.046699327  0.0314480813
#> elt  0.64657094 -2.48771371  0.821391731  0.021227714 -0.0469257004
#> elt -0.08441530 -2.92441274  0.378427718  0.028738201  0.0067218661
#> elt -0.53067423  1.34949272 -0.835220452 -0.048813058 -0.0365070718
#> elt -1.15594435  1.33033489 -0.971359232 -0.025414831  0.0148092618
#> elt  0.79367328 -2.63697962 -0.657069683 -0.044960774 -0.0288158743
#> elt -2.09948703 -1.83581814  0.614496082 -0.032921567 -0.0393909458
#> elt  0.82946845 -0.78850553  0.517715189  0.004026652 -0.0436995254
#> elt  2.21799463  1.65808181 -0.638950109  0.014284641 -0.0465217978
#> elt -1.46006615 -1.17485514  0.992037077 -0.032963758 -0.0291392233
#> elt -1.59277619 -0.32479980 -0.927249355  0.049464466  0.0114881480
#> elt  1.49782906 -1.00186546  0.980203269 -0.036069776 -0.0194828836
#> elt -1.24085892 -2.59140625  0.487412253  0.020289299 -0.0485348954
#> elt  0.39012953 -1.53870104  0.910907058  0.036633093 -0.0097199444
#> elt  1.56731349  0.85302527 -0.976484262 -0.029914531 -0.0044783109
#> elt -1.31565093 -0.27573310  0.754964550  0.035608689  0.0366461525
#> elt -1.95775589 -2.04854721  0.552351312  0.030768446 -0.0395055116
#> elt -1.62365279 -0.60268453  0.963391041  0.022653194 -0.0053874930
#> elt  0.32195027  1.14458975  0.585055878  0.014886355  0.0058034629
#> elt -0.26958936  1.27231605  0.714695177 -0.003475857  0.0060975001
#> elt -1.10092603  1.29578627 -0.954040891  0.021506445 -0.0234173421
#> elt  1.01021747 -0.16347705  0.214878532  0.031937469  0.0187736356
#> elt  2.81321570 -0.88830553  0.311852932 -0.037160310 -0.0442129100
#> elt  0.31731560  0.95323875  0.096487094  0.049801787 -0.0419374371
#> elt  0.53801202  1.26670743  0.781606682  0.012772074 -0.0498900986
#> elt  1.60343247 -2.44556976 -0.381552169  0.005877741  0.0109741065
#> elt -0.92271228  1.52914417  0.976826535  0.025761254 -0.0074751925
#> elt  1.08607425  2.60936276  0.563136912  0.027342288 -0.0305212979
#> elt -0.36325997  1.07125036 -0.495102439 -0.035392174 -0.0172342707
#> elt -0.87980337  0.73197081  0.517770327  0.018060863 -0.0040695532
#> elt  1.52053991  1.46397425  0.993848385 -0.004448415  0.0392953042
#> elt -0.71690846  2.35469226 -0.887187637 -0.047147391  0.0337261188
#> elt  2.38947912 -1.77537884  0.213967914 -0.017987990  0.0190098491