1. Homepage
  2. Programming
  3. CH2107 Introduction to Computational Thinking Assignment: Superellipse

CH2107 Introduction to Computational Thinking Assignment: Superellipse

Engage in a Conversation
SingaporeNTUNanyang Technological UniversityMatlabSuperellipse

Assignment for Introduction to Computational Thinking CourseNana.COM

A superellipse is defined by the inequality !!"!#+!$%!#≤1, where 𝑥 and 𝑦 are the Cartesian coordinates, and 𝑎 and 𝑏 are the length of long and short axes with 𝑛>2 the deformation parameter. An example of a superellipse centered at 𝒓& with 𝑎=2, 𝑏=1 and 𝑛=2.5 is shown in the figure below, where 𝒆! and 𝒆$ are the unit vectors pointing to the direction of long and short axes, respectively, and 𝒆!⊥ 𝒆$. All vectors here are column vectors. CourseNana.COM

Questions: CourseNana.COM

  1. Write a program “CalVolume(a,b,n)” to numerically calculate the area 𝑆 of a superellipse for given 𝑎 and 𝑏. For 𝑎=2, 𝑏=1, plot 𝑆 as a function of 𝑛∈[2,10], and compare your result with the analytical formula 𝑆='!"!#"%√)+,-!#.+!$-!#., where Γ(∙) is the Gamma function. (20 marks)
  2. Write a Matlab program “DrawSuperellipse(𝒓&,𝑎,𝑏,𝑛,𝒆!,𝒆$)”to draw a superellipse entered at 𝒓& for a given 𝑎, 𝑏, 𝑛, 𝒆! and 𝒆$. The input of the program is {𝒓&,𝑎,𝑏,𝑛,𝒆!,𝒆$}. (20 marks)
  3. Write a program “Distance(𝒓,,𝑎,,𝑏,,𝑛,𝒆!,,𝒆$,, 𝒓/,𝑎/,𝑏/,𝑛,𝒆!/,𝒆$/)” using the Newton’s method to calculate the shortest distance between two points on two superellipses {𝒓,,𝑎,,𝑏,,𝑛,𝒆!,,𝒆$,} and {𝒓/,𝑎/,𝑏/,𝑛,𝒆!/,𝒆$/} where 𝑎,=𝑏,=𝑎/=𝑏/=1 for 2<𝑛≤3.4. 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. (60 marks) Table 1 𝒓,=(0,0), 𝒆!,=(1,0), 𝒆$,=(0,1), 𝑎,=𝑏,=𝑎/=𝑏/=1 𝒓/ 𝒆!/ 𝒆$/ 𝑛 (3.0187, 2.6204) (-0.6737, -0.7390) (0.7390, -0.6737) 2.5 (2.7188, 0.4760) (0.8180, 0.5752) (-0.5752, 0.8180) 3.0 (2.3411, 1.0204) (0.6111,0.7916) (-0.7916, 0.6111) 3.4 exeyr0 2 (3.3629, 0.9741) (0.6441, 0.7650) (-0.7650, 0.6441) 3.5 (1.0171, 3.7171) (0.5914, 0.8064) (-0.8064, 0.5914) 5.0 (3.2571, 1.3999) (-0.0472, 0.9989) (-0.9989, -0.0472) 7.0

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Singapore代写,NTU代写,Nanyang Technological University代写,Matlab代写,Superellipse代写,Singapore代编,NTU代编,Nanyang Technological University代编,Matlab代编,Superellipse代编,Singapore代考,NTU代考,Nanyang Technological University代考,Matlab代考,Superellipse代考,Singaporehelp,NTUhelp,Nanyang Technological Universityhelp,Matlabhelp,Superellipsehelp,Singapore作业代写,NTU作业代写,Nanyang Technological University作业代写,Matlab作业代写,Superellipse作业代写,Singapore编程代写,NTU编程代写,Nanyang Technological University编程代写,Matlab编程代写,Superellipse编程代写,Singaporeprogramming help,NTUprogramming help,Nanyang Technological Universityprogramming help,Matlabprogramming help,Superellipseprogramming help,Singaporeassignment help,NTUassignment help,Nanyang Technological Universityassignment help,Matlabassignment help,Superellipseassignment help,Singaporesolution,NTUsolution,Nanyang Technological Universitysolution,Matlabsolution,Superellipsesolution,