Lab 1 – Buyun Ma – MAT 275
Exercise 1
theta = [0 pi/9 pi/7 pi/6 7*pi/6 8*pi/7 9*pi/8];
r = 3;
x = r*cos(theta);
y = r*sin(theta);
r1 = sqrt(x.^2+y.^2);
theta = 0 0.3491 0.4488 0.5236 3.6652 3.5904 3.5343
r = 3
x = 3.0000 2.8191 2.7029 2.5981 -2.5981 -2.7029 -2.7716
y = 0 1.0261 1.3017 1.5000 -1.5000 -1.3017 -1.1481
r1 = 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000
Because r1 is a matrix of 3, the equations x = rcos(theta) and y = rsin(theta) satisfies the equation of
a circle.
Exercise 2
Part(a)
t = linspace(4,20,81);
y = exp(t/20).*cos(2*t)./(0.3*t.^2+5);
title('e^{t/20}cos(2t)/(0.3t^{2}+5)');
plot(t,y,'k');
Part(b)
title('e^{t/20}cos(2t)/(0.3t^{2}+5)')
plot(t,y,'o')
title('e^{t/20}cos(2t)/(0.3t^{2}+5)')
plot(t,y,'o-')
Exercise 3
t = linspace(0,5);
x = 4*cos(9*t);
y = 4*sin(9*t);
z = 3*t;
plot3(x,y,z);
Exercise 4
x = linspace(-pi/7,pi/7);
y = sin(7*x);
z = 7*x-(343/6)*x.^3;
plot(x,y,'r',x,z,'--');
axis tight;
grid on;
Exercise 5
function ex5
x = linspace(0,3)
y1 = f(x,10)
y2 = f(x,15)
y3 = f(x,20)
plot(x,y1,x,y2,'r--',x,y3,'.b')
title('Solution of the defferential equation')
legend('C=10','C=15','C=20')
end
function y = f(x,C)
y = (-5/2)*x.^2+(7/3)*x.^3-14*sin(x)+C
end
run 'ex5.m'
Exercise 6
(a)
g = @(x,y)(x.^6/y.^4+cos(5*x*exp(2*y))/(x.^7+7))
g(5,-4)
ans =
61.0352