lab_1_template

pdf

School

Arizona State University *

*We aren’t endorsed by this school

Course

275

Subject

Mathematics

Date

Apr 3, 2024

Type

pdf

Pages

7

Uploaded by ProfessorWater27041

Report
LAB 1 - Your Name - MAT 275 Exercise 1 Define input variable theta as discretized row vector (i.e. array) theta = [0,pi/8,pi/6,pi/5,(6*pi)/5,(7*pi)/6,(8*pi)/7] theta = 1×7 0 0.3927 0.5236 0.6283 3.7699 3.6652 3.5904 Define radius r=6 r = 6 Define x and y in terms of theta and r x= r*cos(theta) x = 1×7 6.0000 5.5433 5.1962 4.8541 -4.8541 -5.1962 -5.4058 y= r*sin(theta) y = 1×7 0 2.2961 3.0000 3.5267 -3.5267 -3.0000 -2.6033 r = sqrt(x.^2+y.^2) r = 1×7 6.0000 6.0000 6.0000 6.0000 6.0000 6.0000 6.0000 Check that x and y satisfy the equation of a circle Explain results here. Do x and y satisfy the equation of a circle? Why or why not? How does the vector output at the end confirm your answer? x and y satisfy the equation of the circle because for all x and y r=sqrt(x^2+y^2) Exercise 2 Define t-vector t=2:0.1:10 t = 1×81 2.0000 2.1000 2.2000 2.3000 2.4000 2.5000 2.6000 2.7000 Define y-vector 1
y= exp(t/15).*cos(2*t)./(0.2*t.^2+4); Part (a) Plot results (should have 3 plots total) figure; plot(t,y, 'o' ); title( 'y= exp(t/15).*cos(2*t)./(0.2*t.^2)+4;' ) %couldn't figure out how to stop the +4 from appearing like an exponent %It appears my default graph color is blue Part (b) Plot results as data points only and as data points with line. figure %creates another figure window plot(t,y, 'o-' ); title( 'y= exp(t/15).*cos(2*t)./(0.2*t.^2+4)' ) 2
Exercise 3 Create t-vector (choose enough elements so that plot is smooth!) t = 0:0.1:20; Define x, y, x components in terms of t x = 8*cos(2*t); y = 8*sin(2*t); z = 4*t; Plot results figure; plot3(x,y,z) 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Exercise 4 Define input variable as vector x= -pi/7:0.01:pi/7; Define y and z y = sin(7*x); z =7*x-(343/6)*x.^3; Plot results figure; plot(x,y, 'r' ,x,z, '--' ) axis tight ; grid on 4
Exercise 5 type ex5.m x=0:0.01:3; y1=f(x,20); y2=f(x,40); y3=f(x,60); plot(x,y1,'r-',x,y2,'b-',x,y3,'k-') title('Solutions to dy/dx = 17*x+4*x.^2-2*cos(x)') legend('C=20','C=40','C=60') function y=f(x,C) y=(17/2)*x.^2+(4/3)*x.^3-2*sin(x)+C; end Run your M-file--i.e. execute the M-file run 'ex5.m' 5
Exercise 6 Part (a) Define g as anonymous function g=@(x,y)((x.^5/y.^3)+(cos(6*x*exp(9*y))))/((x.^6)+3); Evaluate g at the given values of x and y g(-9,3) ans = -0.0041 Part (b) Clear the function g out of the workspace clear g Print out g.m contents type 'g.m' 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
function z = g(x,y) z=((x^5/y^3)+(cos(6*x*exp(9*y))/(x^6+3))); end Evaluate g at the given values of x and y g(-9,3) ans = -2.1870e+03 The End!!! 7