New version page

# UT Dallas MATH 4334 - Lab Assignment

Pages: 11
Documents in this Course

12 pages

Unformatted text preview:

Table of ContentsProblem 1 Arithmetic OperationsProblem 2.1a PlottingProblem 2.1b PlottingProblem 2.2a PlottingProblem 2.2b PlottingProblem 3 Matrix and Vector OperationsProblem 4.1 IF Statements, Logical Operators, and For LoopsProblem 4.2 IF Statements, Logical Operators, and For LoopsProblem 4.3 IF Statements, Logical Operators, and For LoopsTable of ContentsProblem 1 Arithmetic Operations ........................................................................................... 1Problem 2.1a Plotting .......................................................................................................... 1Problem 2.1b Plotting .......................................................................................................... 2Problem 2.2a Plotting .......................................................................................................... 3Problem 2.2b Plotting .......................................................................................................... 4Problem 3 Matrix and Vector Operations ................................................................................ 5Problem 4.1 IF Statements, Logical Operators, and For Loops .................................................... 9Problem 4.2 IF Statements, Logical Operators, and For Loops ................................................... 10Problem 4.3 IF Statements, Logical Operators, and For Loops ................................................... 11Problem 1 Arithmetic Operationsclear, clcx = (5^3)/(3^2+1)y = (1-1/(2^4))^(-1)N = (x/2+(x^2)/6+(x^(3/2))/5-6/(x*y))^(1/2)x = 12.5000y = 1.0667N = 6.3781Problem 2.1a Plottingclear, clcx = linspace(-10,10,200);y = (10.*x)-(x.^3).*cos(x)-200;plot(x,y)title('y = 10x-(x^3)*cos(x)-200')xlabel('x-->')ylabel('y-->')1Problem 2.1b Plottingclear, clcx = linspace(-10,10,200);t = sin(x).^2;plot(x,t)title('t = sin^2(x)')xlabel('x-->')ylabel('t-->')2Problem 2.2a Plottingclear, clcx = linspace(-10,10,60);y = linspace(-5,5,30);[X,Y]=meshgrid(x,y);Z=(X./5)+(Y.^2)/9-10*X.*Y;surf(X,Y,Z)xlabel('x','FontSize',18)ylabel('y','FontSize',18)zlabel('z','FontSize',18)3Problem 2.2b Plottingclear, clcx = linspace(-10,10,60);y = linspace(-5,5,30);[X,Y]=meshgrid(x,y);V = (cos(X).^2).*(sin(Y).^2);surf(X,Y,V)xlabel('x','FontSize',18)ylabel('y','FontSize',18)zlabel('v','FontSize',18)4Problem 3 Matrix and Vector Operationsclear, clcA = 1*rand(8,8)B = ones(8,8)R = A*BR(:,4) = 4R(5,:) = log(3)R(7:8,7:8) = pi^2x = A(1,:)*A(:,3)y = B(2,2)/B(7,7)m = (x*y)/sqrt(x+y)D = m*(R')D(4,:)=[]A = Columns 1 through 7 0.1734 0.6569 0.3724 0.2691 0.6663 0.0326 0.1564 0.3909 0.6280 0.1981 0.4228 0.5391 0.5612 0.8555 0.8314 0.2920 0.4897 0.5479 0.6981 0.8819 0.6448 0.8034 0.4317 0.3395 0.9427 0.6665 0.6692 0.3763 0.0605 0.0155 0.9516 0.4177 0.1781 0.1904 0.1909 0.3993 0.9841 0.9203 0.9831 0.1280 0.3689 0.428350.5269 0.1672 0.0527 0.3015 0.9991 0.4607 0.4820 0.4168 0.1062 0.7379 0.7011 0.1711 0.9816 0.1206 Column 8 0.5895 0.2262 0.3846 0.5830 0.2518 0.2904 0.6171 0.2653B = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1R = Columns 1 through 7 2.9166 2.9166 2.9166 2.9166 2.9166 2.9166 2.9166 3.8219 3.8219 3.8219 3.8219 3.8219 3.8219 3.8219 4.7703 4.7703 4.7703 4.7703 4.7703 4.7703 4.7703 4.8122 4.8122 4.8122 4.8122 4.8122 4.8122 4.8122 2.2566 2.2566 2.2566 2.2566 2.2566 2.2566 2.2566 4.5023 4.5023 4.5023 4.5023 4.5023 4.5023 4.5023 3.6071 3.6071 3.6071 3.6071 3.6071 3.6071 3.6071 3.5006 3.5006 3.5006 3.5006 3.5006 3.5006 3.5006 Column 8 2.9166 3.8219 4.7703 4.8122 2.2566 4.5023 3.6071 3.5006R =6Columns 1 through 7 2.9166 2.9166 2.9166 4.0000 2.9166 2.9166 2.9166 3.8219 3.8219 3.8219 4.0000 3.8219 3.8219 3.8219 4.7703 4.7703 4.7703 4.0000 4.7703 4.7703 4.7703 4.8122 4.8122 4.8122 4.0000 4.8122 4.8122 4.8122 2.2566 2.2566 2.2566 4.0000 2.2566 2.2566 2.2566 4.5023 4.5023 4.5023 4.0000 4.5023 4.5023 4.5023 3.6071 3.6071 3.6071 4.0000 3.6071 3.6071 3.6071 3.5006 3.5006 3.5006 4.0000 3.5006 3.5006 3.5006 Column 8 2.9166 3.8219 4.7703 4.8122 2.2566 4.5023 3.6071 3.5006R = Columns 1 through 7 2.9166 2.9166 2.9166 4.0000 2.9166 2.9166 2.9166 3.8219 3.8219 3.8219 4.0000 3.8219 3.8219 3.8219 4.7703 4.7703 4.7703 4.0000 4.7703 4.7703 4.7703 4.8122 4.8122 4.8122 4.0000 4.8122 4.8122 4.8122 1.0986 1.0986 1.0986 1.0986 1.0986 1.0986 1.0986 4.5023 4.5023 4.5023 4.0000 4.5023 4.5023 4.5023 3.6071 3.6071 3.6071 4.0000 3.6071 3.6071 3.6071 3.5006 3.5006 3.5006 4.0000 3.5006 3.5006 3.5006 Column 8 2.9166 3.8219 4.7703 4.8122 1.0986 4.5023 3.6071 3.5006R = Columns 1 through 7 2.9166 2.9166 2.9166 4.0000 2.9166 2.9166 2.9166 3.8219 3.8219 3.8219 4.0000 3.8219 3.8219 3.821974.7703 4.7703 4.7703 4.0000 4.7703 4.7703 4.7703 4.8122 4.8122 4.8122 4.0000 4.8122 4.8122 4.8122 1.0986 1.0986 1.0986 1.0986 1.0986 1.0986 1.0986 4.5023 4.5023 4.5023 4.0000 4.5023 4.5023 4.5023 3.6071 3.6071 3.6071 4.0000 3.6071 3.6071 9.8696 3.5006 3.5006 3.5006 4.0000 3.5006 3.5006 9.8696 Column 8 2.9166 3.8219 4.7703 4.8122 1.0986 4.5023 9.8696 9.8696x = 1.5758y = 1m = 0.9818D = Columns 1 through 7 2.8636 3.7525 4.6836 4.7248 1.0787 4.4205 3.5416 2.8636 3.7525 4.6836 4.7248 1.0787 4.4205 3.5416

View Full Document