mercredi 20 octobre 2021

Random Numbers in a Non-convex Domain

I want to create an array of random floating-point numbers in MATLAB that are inside the boundary D_0 and outside the boundary D_1 where the boundaries are

  1. D_0 = [x ,y] where x = Ro_0.*cos(t); y = Ro_0.*sin(t); Ro_0 = 4*sqrt(cos(2*t)+sqrt(1.1-sin(2*t).^2)); and t \in [0, 2*pi]

  2. D_1 = [x ,y] where x = -3+Ro_0.*cos(t); y = Ro_0.*sin(t); Ro_0 = 1/2+(cos(4*t)).^2; and t \in [0, 2*pi]

How can I create this array in MATLAB? I use inpolygon, but it does not work for me.

Something like this picture; I need to have blue ones.enter image description here




Aucun commentaire:

Enregistrer un commentaire