cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

16-Pearl

## Creating the “enveloping” ellipse for a Monte Carlo plot?

To all

I am doing my 1st step with the montecarlo() function in mcad 15. I copied the example and put my own function and it seems to work fine.

Does anyone know if there is a way of getting/creating the “enveloping” ellipse one often sees on a Monte Carlo plot? I attached one on which I drew the ellipse

I think the length of the minor and major axis have a meaning (in the Mont Carlo world) byut can’t quite remember what it is!

ACCEPTED SOLUTION

Accepted Solutions
16-Pearl
(To:JBlackhole)

Get the mean data X0 =(x0,y0)

Get pts

1: X1=(x1,y1) x1=min(x), y(x1)

2: X2=(x2,y2) x2=max(x), y(x2)

Centre of the ellipse is X0

Major axis a =|| X2-X1||

Rotation angle of the ellipse atan(|X2|/|X1|)

Search minor axis (b) to envelope all the pts

Plot ellipse translated by X0 and rotated by alpha

11 REPLIES 11
16-Pearl
(To:JBlackhole)

Get the mean data X0 =(x0,y0)

Get pts

1: X1=(x1,y1) x1=min(x), y(x1)

2: X2=(x2,y2) x2=max(x), y(x2)

Centre of the ellipse is X0

Major axis a =|| X2-X1||

Rotation angle of the ellipse atan(|X2|/|X1|)

Search minor axis (b) to envelope all the pts

Plot ellipse translated by X0 and rotated by alpha

23-Emerald I
(To:JBlackhole)

And the minor axis is?

Haven’t quite work this out in detail – I thought I had something !

I know that it is a vector normal to a =|| X2-X1|| and must be of such length as to enclosed all (most) of the points

Some of steps work fine in a stand-alone example but not when I try to integrate it to the monte-carlo plot

So kind of a step back !

23-Emerald I
(To:JBlackhole)

You've calculated the angle for the major axis.  (I liked what you've got so far.

Now

Rotate all of the data so that the major axis is parallel to the x axis.

Then the length of the minor axis is max(y)-min(y).  And the minor axis is normal to the major axis, so you know the whole ellipse.

Indeed

so I need to rotate each pair of data (from the data set from the montcarlo output)

`data=augment(hv,R)`

(where hv is the variable and R1 the output of the montcarlo)

if Rz is the rotation matrix (anticlockwise)

`datarotate=(Rz(-beta)*data^T)^T`

where beta is the angle for the major axis

Cannot plot this ! so must work on each set of data

Working on a cut-down version of the test sheet to post

23-Emerald I
(To:JBlackhole)

a poor example (created in 4.0 express)

Thanks

Why is there no way of rotating the "scatter" data M(x,y) using a rotation matrix?

Mrot(x',y') = R(alpha).M(x',y')

23-Emerald I
(To:JBlackhole)

@JBlackhole wrote:

Thanks

Why is there no way of rotating the "scatter" data M(x,y) using a rotation matrix?

Mrot(x',y') = R(alpha).M(x',y')

There is; you'd need to have the data paired (x,y) rather than two separate vectors.

16-Pearl
(To:JBlackhole)

Here's a solution that uses Minimize to make an ellipse of minimum area that includes all the points.  Seems to work.

4.0/pdf attached

16-Pearl
(To:DJF)

Thanks for that.

Thanks to Fred and yourself for the input. Really appreciated

23-Emerald I
(To:DJF)

VERY NICE!!

Announcements

Top Tags