Lab 1: Intro to MATLAB and FreeMat --> A =[3 4 5; 21 5 2; 1 -2 10] --> b = [ 32; 20 ; 120] The matrix equation A u = b is solved by pre-multiplying both sides by 1/A to get u = 1/A * b Note that since we are using matrices here, the order of operation is critical. It would be wrong to say u=b/A, even though that would work in basic algebra. We have to pre- multiply by the inverse of A. can say Matlab provides two ways to do this...using "Left division" (the backslash symbol), we u = A \b (This is the recommended approach for speed and accuracy). Or u inv (A) * b we can use the matrix inverse function inv(): --> u=A\b u = 1.4497 (value of x) -6.3249 (value of y) 10.5901 (value of z) Finally, to prove you have the correct answer, you can plug these values in the original equation check = A* u and see if you get the b vector you started with. If you don't, there may be something wrong with the specification of the system resulting in numeric instability. First type in the previous example to make sure you get the correct answer. Then solve the following sets of equations: Question 9. Find the solution to the following system and paste your code and answer into the Labl datasheet. x+y+z = 6 2x+5y+ z 15 -3x+y+5z-14 Question 10. Solve the following word probolem. Copy the script file and answer into the datasheet. Make a new data in the previous table. Defin sure I is on the x-axis and V is on the y-axis. Add labels and a title to your plot and copy and define the vector I the same way. Then use the plot command to plot the data. Make (Select Tools > Copy) and paste it in your report as well as the code that produced it. Part 6. Solving Systems of Equations Consider a common occurrence in Engineering, the need to solve a system of simultaneous equations: 3x+4y+5z=32 21x+5y+2z=20 x-2y+10z 120 In this case we are looking for a solution set-a value of x, y, and z-that satisfies all 3 equations. In general, these 3 equations could have 1 solution, many solutions, or NO solutions. For now, we will look for a single solution using matrix algebra. The method involves setting up the equation in matrix/vector form, in other words, 321 45 52 -2 10 4XX 32 = 20 120 By separating the coefficients from the unknowns, we can rewrite the above system of equations as a single matrix algebra equation: A u = b, 3 45 32 X where A= 21 5 2 b = 20 and u = " , y 1 -2 10 120 Z There are many ways of solving the system as we've currently defined it. MATLAB is particularly effective, since it was initially designed to process large matrix algebra systems with thousands of degrees of freedom (unknowns). In Matlab, we simply define the A matrix and the b vector by typing (TRY THIS):
Lab 1: Intro to MATLAB and FreeMat --> A =[3 4 5; 21 5 2; 1 -2 10] --> b = [ 32; 20 ; 120] The matrix equation A u = b is solved by pre-multiplying both sides by 1/A to get u = 1/A * b Note that since we are using matrices here, the order of operation is critical. It would be wrong to say u=b/A, even though that would work in basic algebra. We have to pre- multiply by the inverse of A. can say Matlab provides two ways to do this...using "Left division" (the backslash symbol), we u = A \b (This is the recommended approach for speed and accuracy). Or u inv (A) * b we can use the matrix inverse function inv(): --> u=A\b u = 1.4497 (value of x) -6.3249 (value of y) 10.5901 (value of z) Finally, to prove you have the correct answer, you can plug these values in the original equation check = A* u and see if you get the b vector you started with. If you don't, there may be something wrong with the specification of the system resulting in numeric instability. First type in the previous example to make sure you get the correct answer. Then solve the following sets of equations: Question 9. Find the solution to the following system and paste your code and answer into the Labl datasheet. x+y+z = 6 2x+5y+ z 15 -3x+y+5z-14 Question 10. Solve the following word probolem. Copy the script file and answer into the datasheet. Make a new data in the previous table. Defin sure I is on the x-axis and V is on the y-axis. Add labels and a title to your plot and copy and define the vector I the same way. Then use the plot command to plot the data. Make (Select Tools > Copy) and paste it in your report as well as the code that produced it. Part 6. Solving Systems of Equations Consider a common occurrence in Engineering, the need to solve a system of simultaneous equations: 3x+4y+5z=32 21x+5y+2z=20 x-2y+10z 120 In this case we are looking for a solution set-a value of x, y, and z-that satisfies all 3 equations. In general, these 3 equations could have 1 solution, many solutions, or NO solutions. For now, we will look for a single solution using matrix algebra. The method involves setting up the equation in matrix/vector form, in other words, 321 45 52 -2 10 4XX 32 = 20 120 By separating the coefficients from the unknowns, we can rewrite the above system of equations as a single matrix algebra equation: A u = b, 3 45 32 X where A= 21 5 2 b = 20 and u = " , y 1 -2 10 120 Z There are many ways of solving the system as we've currently defined it. MATLAB is particularly effective, since it was initially designed to process large matrix algebra systems with thousands of degrees of freedom (unknowns). In Matlab, we simply define the A matrix and the b vector by typing (TRY THIS):
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Question 9 find the solution to the following systems and paste your code answer
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
Similar questions
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education