logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Martinha RosaFinance
(5/5)

632 Answers

Hire Me
expert
Cristopher WebbTechnical writing
(5/5)

832 Answers

Hire Me
expert
Bryan CoxxEconomics
(5/5)

956 Answers

Hire Me
expert
Doug BeaucheminAccounting
(5/5)

876 Answers

Hire Me
MATLAB
(5/5)

You will receive a warning because the function is not defined everywhere on the xy plane but that is ok

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Matlab Assignment

General Information:

The Matlab website is full of useful information if you want to learn more Matlab Support

The University Software Portal has information on how to download Mat- lab or if preferred how to work with the online version of Matlab.

Part 1

Parametrizing Curves:

Viviani’s curve is defined as the intersection of the sphere x2 + y2 + z2 = 4 with the cylinder (x − 1)2 + y2 = 1. Observe that

x = 1 + cos t

z = ±2 sin   t  

gives a parametrization of this curve [this uses the identity sin   t  

>> syms t; x=1 +cos(t); y=sin(t), z=2*sin(t/2);

>> fplot3(x,y,z, [0 pi])

Exercise 1. Save the image you get as a pdf or jpeg file.

The figure you obtained should not be terribly illuminating. We ca get rid of the grid that by default surrounds all three-dimensional graphics in MATLAB. We can dispense with the labels ad tick marks on the axes. It is also helpful to show the curve inside the sphere and the cylinder that are used to define it. We can show the arcs obtained by intersecting with the coordinate planes, as well as the projected circle on the xy plane. 

>> hold on

>> fplot3(sym(0), 2*cos(t/2), 2*sin(t/2), [0 pi])

>> fplot3(2*cos(t/2), sym(0), 2*sin(t/2), [0 pi])

>> fplot3(2*cos(t/2), 2*sin(t/2), sym(0), [0 pi])

>> fplot3(1+cos(t), sin(t), sym(0), [0 pi])

>> fplot3(sym(0), sym(0), t, [0 2])

>> fplot3(sym(0), t, sym(0), [0 2])

>> fplot3(t, sym(0), sym(0), [0 2])

>> title(’ ’); xlabel(’ ’); ylabel(’ ’); zlabel(’ ’);

>> grid off; axis off; view ([10,3,1])

Exercise 2. Save the image you get as a pdf or jpeg file.

Exercise 3. Identify which fplot3 commands correspond to

The x-axis, y-axis, z-axis

Circle arc on the xy plane, xz plane, yz plane

Circle (x − 1)2 + y2 = 1 on the xy plane

You can enter comments on Matlab directly by using the % symbol.

Exercise 4. Now plot the curve which is obtained as the intersection of the paraboloid z = x2 + y2 with the cylinder (x  1)2 + y2 = 1. Use the interval [0 2*pi] instead of [0 pi]. Hint: notice that this is the same cylinder as before so x and y are given by the same functions of

t. Only z changes.

Graphing Functions:

fsurf and fmesh are the basic MATLAB commands for graphing a function of two variables. For example, suppose we want to graph the function

f (x, y) = y   1 1

(x2 + y2)

Exercise 5. What is the domain of this function?

To plot it write

>> flowfunction= @(x,y) y*(1-1/(x^2+y^2));

>> figure; fsurf(flowfunction, [-2 2 -2 2])

You will receive a warning because the function is not defined everywhere on the xy plane but that is ok.’

Exercise 6. Save the image you get as a pdf or jpeg file.

To graph level curves we can use:

 >> list1= -2:0.5:2; figure; fcontour(flowfunction, [-2 2 -2 2], ’LevelList’, list1);

Exercise 7. Save the image you get as a pdf or jpeg file.

To shade the regions between the level curves selected use

>> figure; fcontour(flowfunction, [-2 2 -2 2], ’LevelList’, list1, ’Fill’, ’on’)

Exercise 8. Save the image you get as a pdf or jpeg file.

Exercise 9. Plot the function f (x, y) = (x2 + y2)2 x2 + y2, and define list1=[-0.2, -0.1], list2=[0.1, 0.2, 1, 4, 10], list3=[0] Compare the level curves of f for these different values. Save the images you get. Use the grid [-1 1 -1 1]

Part 2

Surfaces and Vector Fields:

>> syms x y z; h=z^2 -x^2-y^2;

>> fimplicit3(h-1, [-1.1 1.1 -1.1 1.1 -2 2]); axis equal

Exercise 10. Save the image you get as a pdf or jpeg file.

With the command quiver3 we can visualize gradient vectors. Write

>> [X,Y]=meshgrid(-1:0.5:1., -1:0.5:1.);

>> Z=sqrt(1+X.^2+Y.^2);

>> [U,V,W]=surfnorm(X,Y,Z);

>> hold on; quiver3(X,Y,Z,U,V,W,2)

>> Z1= -sqrt(1+X.^2+Y.^2);

>> [U,V,W]= surfnorm(X,Y,Z1);

>> quiver3(X,Y,Z1,U,V,W,2)

Exercise 11. Save the image you get as a pdf or jpeg file.

Exercise 12. Plot the ellipsoid f (x, y, z) = x2 + 2y2 + 3z2 = 1 together with the tangent plane at the point (1, 0, 0)

Parametrizing Surfaces:

A parametrization of the sphere x2 + y2 + z2 = 1 in spherical coordinates θ, φ:

x = cos u sin v y = sin u sin v z = cos v

Here u is playing the role of θ while v is playing the role of φ.

To plot the sphere use

>> syms u v real; sphere= [cos(u)*sin(v), sin(u)*sin(v), cos(v)];

>> fsurf(sphere(1), sphere(2), sphere(3), [0 2*pi 0 pi])

>> view([1,1,1]); title(’ ’); xlabel(’ ’); ylabel(’ ’); zlabel(’ ’);

>> grid off; axis equal; axis off;

Exercise 13. Save the image you get as a pdf or jpeg file.

Exercise 14. Parametrize the monkey saddle z = x3    3xy2  by using u = x, v = y as the parameters. Notice that here it makes more sense to use both negative and positive values of u, v

Exercise 15. Save the image you get as a pdf or jpeg file.

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme