The first problem is from S. Attaway. MATLAB A Practical Introduction to Program
ID: 3671010 • Letter: T
Question
The first problem is from S. Attaway. MATLAB A Practical Introduction to Programming and Problem Solving (3rd Edition). For each problem, print out the script tile if created along with the function file(s) and the relevant Command Window output. Also, show analytical work where appropriate. For this exercise, the function can be accessed from the command mode if you prefer. Test the function from the command mode for the complex numbers 3 + 4 i 2 + 6i -2 + 6 i -6-2i 2 - 6i The arctan function (atan) computes angles correctly only in the first and fourth quadrants and displays them in the range - pi>2Explanation / Answer
1) Answers are
// Angle in dergee
function angle = angle_radain(l)
for i = 1:6
C = l(:,i);
if (real(C) >= 0 && imag(C) >= 0)
angle = atand(C);
elseif ((real(C) < 0 && imag(C) > 0)|| (real(C) < 0 && imag(C) < 0))
angle = atand(C) + 180;
elseif (real(C) >= 0 && imag(C) < 0)
angle = atand(C) + 360;
end
end
end
2) Script
a = 3; b = 2; c = 1; k1 = 5;
d = -1; e = 5; f = -2; k2 = -3;
g = 4; h = -7; i = 3; k3 = 10;
det = det3(a,b,c,d,e,f,g,h,i);
detx = det3(k1,b,c,k2,e,f,k3,h,i);
dety = det3(a,k1,c,d,k2,f,g,k3,i);
detz = det3(a,b,k1,d,e,k2,g,h,k3);
x = detx/det;
y = dety/det;
z = detz/det;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.