Question: A superellipse is defined by the inequality | ( x ) / ( a ) | ^ ( n ) + | ( y )

A superellipse is defined by the inequality
|(x)/(a)|^(n)+|(y)/(b)|^(n)=1,
where x and y are the Cartesian coordinates, and a and b are the length of long and short axes
with n>2 the deformation parameter. An example of a superellipse centered at r_(0) with a=
2,b=1 and n=2.5 is shown in the figure below, where e_(x) and e_(y) are the unit vectors
pointing to the direction of long and short axes, respectively, and e_(x)_(|)_(e)_(y). All vectors here
are column vectors.
Questions:
Write a program "CalVolume (a,b,n)" to numerically calculate the area S of a
superellipse for given a and b. For a=2,b=1, plot S as a function of nin[2,10],
and compare your result with the analytical formula
S=((4^(1-(1)/(n)))/(a)bs qrt\pi \Gamma (1+(1)/(n)))/(\Gamma ((1)/(2)+(1)/(n)))
where \Gamma (*) is the Gamma function.
(20 marks)
Write a Matlab program "DrawSuperellipse (r_(0),a,b,n,e_(x),e_(y))"to draw a superellipse
entered at r_(0) for a given a,b,n,e_(x) and e_(y). The input of the program is
{r_(0),a,b,n,e_(x),e_(y)}.
(20 marks)
Write a program "Distance (r_(1),a_(1),b_(1),n_(-),e_(x1),e_(y1),r_(2),a_(2),b_(2),n_(),e_(x2),e_(y2))" using the
Newton's method to calculate the shortest distance between two points on two
superellipses {r_(1),a_(1),b_(1),n_(1),e_(x1),e_(y1)} and {r_(2),a_(2),b_(2),n_(n),e_(x2),e_(y2)} where a_(1)=b_(1)=
a_(2)=b_(2)=1 for 2. The program should return a value of 0 if two
superellipses are overlapped. Use your program to calculate the shortest distance
between two superellipses with the location and orientation listed in Table 1, and draw
the two closest points on the two superellipses.
Table 1
Please assist in coming up with the matlab script for Question 3 only using Newton Method only (1D OR 2D), thank you so much in advance. The correct shortest distances are approximately 1.9178 units when n =2.5,0.64638 units when n=3.0,0.33277 units when n=3.4. Maybe come up with matlab scripts of first derivative , second derivative , distance , newton , starting point, transform , closestpoint,etc?
A superellipse is defined by the inequality | ( x

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!