| MATLAB Central > MATLAB Newsreader > How can i plot filled round |
|
|
|
Hi, |
|
If you mean an ellipse, then you could determine the maximum and minimum x and y values on that ellipse. Let us say, it extends from xmin to xmax and ymin to ymax. Then, you can generate uniformly distributed random numbers in these two ranges and select those that are inside the ellipse. |
|
Could you give me an example? |
|
I had done something similar in the past and fortunately I found the code. At a first glance, it may look complex but in deed it is not. What it does is, it first assumes the major axis is along the x-axis and the minor is along the y-axis [although you can still input values such that major < minor. This is just the naming convention of the code]. It generates points inside this horizontal ellipse [satisfying a smaller-than-or-equal-to inequality] and the number of points is determined by the user. The other inputs are the center (x0,y0) of the ellipse, and the angle it makes with the x-axis [angleOfRotation], as well as the major axis and minor axis lengths. The final input is just to control drawing. If it is 1, the points are plotted with the actual elliptic border surrounding and the two axes. If it is 0, no drawing is performed. In both cases, the output of the function is the set |
|
Thanks for he answer. |
|
The only trick that I can think of is to zoom out by setting the axis limits larger than they are. For instance, in the example you gave with rand, a solution could be setting the limits as follows: |
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
