MATLAB Assignment 3.2: Parametric Vector Form My Solutions > Write a MATLAB function pvss that takes...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
MATLAB Assignment 3.2: Parametric Vector Form My Solutions > Write a MATLAB function pvss that takes as input the coefficient matrix and right hand side of a linear system and returns the parametric vector form of the solution in the following format: ▪ function [sscount, p, V] = pvss (A,b) ▪ sscount = -1 if the system is inconsistent (signaled by a pivot in the last column of rref ( [A b]). ▪ sscount = 0 if the system has a unique solution (signaled by a lack of free variables) ▪ sscount is the number of free variables of the system (number of columns of V) otherwise ▪p is the particular solution corresponding to all free variables being equal to zero (empty vector if sscount=-1), ▪ V is the matrix whose columns are homogeneous solutions (i.e. solutins of ) corresponding to one of the free variables equal to 1 while the others are 0 (empty list of columns if sscount <= 0). ▪ The provided template provides code to implement pvss except for the determination of v which can be implemented by completing four four lines in the code marked "UPDATE". Function > 1 function [sscount, p, V] = pvss(A,b) % For the linear system Ax=b finds the parametric vector form of the solution. 3 % If no solutions sscount=-1; otherwise, sscount is number of free variables 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 end % p is the particular solution with the free variables equal to zero (empty if sscount== -1) % ith column of V is the homogeneous solution corresponding to the ith free variable (empty if sscount <= 0) Augmented [a b]; [m, n] = size (Augmented); [R, pclist] = rref(Augmented); r = size(pclist, 2); % CASE OF AN INCONSISTENT SYSTEM if r>0 && pclist (r)==n sscount = -1; p = zeros(n-1,0); V = zeros(n-1,0); return end % OBTAIN THE PARTICULAR SOLUTION p = zeros(n-1,1); p(pclist) = R(1:r,n); % OBTAIN THE HOMOGENEOUS SOLUTIONS CORRESPONDING TO EACH FREE VARIABLE (IF ANY) % UPDATE: determine number of free variables (sscount) % UPDATE: find the list of free variables sscount = fvlist= v(pclist, :) = V(fvlist, :) = Save % rreduced row echelon form and pivot column list % number of pivot columns (rank(A)) % UPDATE: copy appropriately pivot rows of V from R % UPDATE: set free rows of V appropriately C Reset MATLAB Documentation Code to call your function > 1A=[1 2 3; 4 5 6; 7 8 9] 2 b=[1; 1; 1] 3 [sscount, P, V] = pvss (A, b) C Reset MATLAB Assignment 3.2: Parametric Vector Form My Solutions > Write a MATLAB function pvss that takes as input the coefficient matrix and right hand side of a linear system and returns the parametric vector form of the solution in the following format: ▪ function [sscount, p, V] = pvss (A,b) ▪ sscount = -1 if the system is inconsistent (signaled by a pivot in the last column of rref ( [A b]). ▪ sscount = 0 if the system has a unique solution (signaled by a lack of free variables) ▪ sscount is the number of free variables of the system (number of columns of V) otherwise ▪p is the particular solution corresponding to all free variables being equal to zero (empty vector if sscount=-1), ▪ V is the matrix whose columns are homogeneous solutions (i.e. solutins of ) corresponding to one of the free variables equal to 1 while the others are 0 (empty list of columns if sscount <= 0). ▪ The provided template provides code to implement pvss except for the determination of v which can be implemented by completing four four lines in the code marked "UPDATE". Function > 1 function [sscount, p, V] = pvss(A,b) % For the linear system Ax=b finds the parametric vector form of the solution. 3 % If no solutions sscount=-1; otherwise, sscount is number of free variables 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 end % p is the particular solution with the free variables equal to zero (empty if sscount== -1) % ith column of V is the homogeneous solution corresponding to the ith free variable (empty if sscount <= 0) Augmented [a b]; [m, n] = size (Augmented); [R, pclist] = rref(Augmented); r = size(pclist, 2); % CASE OF AN INCONSISTENT SYSTEM if r>0 && pclist (r)==n sscount = -1; p = zeros(n-1,0); V = zeros(n-1,0); return end % OBTAIN THE PARTICULAR SOLUTION p = zeros(n-1,1); p(pclist) = R(1:r,n); % OBTAIN THE HOMOGENEOUS SOLUTIONS CORRESPONDING TO EACH FREE VARIABLE (IF ANY) % UPDATE: determine number of free variables (sscount) % UPDATE: find the list of free variables sscount = fvlist= v(pclist, :) = V(fvlist, :) = Save % rreduced row echelon form and pivot column list % number of pivot columns (rank(A)) % UPDATE: copy appropriately pivot rows of V from R % UPDATE: set free rows of V appropriately C Reset MATLAB Documentation Code to call your function > 1A=[1 2 3; 4 5 6; 7 8 9] 2 b=[1; 1; 1] 3 [sscount, P, V] = pvss (A, b) C Reset
Expert Answer:
Answer rating: 100% (QA)
From the provided MATLAB assignment details and the code template it seems that you are required to ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Superior Company provided the following data for the year ended December 31 (all raw materials are used in production as direct materials): Selling expenses Purchases of raw materials Direct labor...
-
For this prompt, consider your academic goals, including (but not limited to) such topics as how you plan to manage your time to fit in your studies; how you will build your skills, as needed; how...
-
2. From the solid model presented in the following figure, (a) find the coordinates of the center C stored in the model database and the respective mapping matrix [T] that maps point from WCS for the...
-
Copper Products Limited leases property on which copper has been discovered. The lease provides for an immediate payment of $472,000 to the lessor before drilling has begun and an annual rental of...
-
The following condensed information is available for Yellow Media Inc., Canada's largest Internet media and marketing company: Instructions (a) Using vertical analysis, calculate the percentage of...
-
A piston/cylinder has a water volume separated in V A = 0.2 m 3 and V B = 0.3 m 3 by a stiff membrane (Fig. P3.211). The initial state in A is 1000 kPa, x = 0.75 and in B it is 1600 kPa and 250C. Now...
-
Saturn Corporation issued \(\$ 400,000\) of \(6 \%\) bonds payable on June 30. The bonds were dated April 30, and the semiannual interest dates are April 30 and October 31. 1. How much cash will...
-
United Furniture buys reclining rocking chairs at $550 less 40% and 10%. The price is marked up to allow for overhead of 50% of cost and profit of 35% of cost. The unit on display in the store...
-
7-16 Flexible budget. Brabham Enterprises manufactures tires for the Formula I motor racing circuit. For August 2012, it budgeted to manufacture and sell 3,000 tires at a variable cost of $74 per...
-
As a financial analyst at Glencolin International (GI) you have been asked to evaluate two capital investment alternatives submitted by the production department of the firm. Before beginning your...
-
Taneshas company is looking at options for migrating some of their web servers to a cloud service. However, no one on the team currently knows much about cloud providers and what kinds of services...
-
Victoria is developing symptoms of senile dementia and there are times when she does not fully grasp the consequences nor the reality of her actions Victoria hears noise in attic and calls Sam'...
-
How does sharding (or partitioning) help with building a scalable database ?
-
Eliot Sprinkler Systems produces equipment for lawn irrigation. One of the parts used in selected Eliot equipment is a specialty nozzle. The budgeting team is now determining the purchase...
-
Consider the situation of John, aged 15, who is found to be a mature minor. He decides to stop cancer treatment. His oncology team supports his decision. He has been in treatment for two years and...
-
Identify three or more risks associated with grief and bereavement support ?
-
4 Lupo Corporation uses a job-order costing system with a single plantwide predetermined overhead rate based on machine-hours. The company based its predetermined overhead rate for the current year...
-
Explain the term "Equivalent Units". Why are they calculated in process costing? [4 Marks] [minimum 350 words]
-
Consider the linear system Au = b, where (a) What is the solution? (b) Discuss the convergence of the Jacobi iteration method. (c) Discuss the convergence of the Gauss-Seidel iteration method. (d)...
-
A bar of length = 1 has stiffness function c(x) = I -F x. Find and graph the displacement, stress and strain when the bar is subjected to a unit gravitational force, assuming there is no...
-
Consider the linear system 4x - y - z = 1 -x + 4y - w = 2 -x + 4z - w = 0 - y - z + 4w = 1. (a) Find the solution by using Gaussian Elimination and Back Substitution. (b) Using 0 as your initial...
-
Paul Polishan graduated with an accounting degree in 1969 and immediately accepted an entry-level position in the accounting department of The Leslie Fay Companies, a womens apparel manufacturer...
-
After completing Part A of this assignment, your instructor may ask you to complete Part B. Do not proceed to Part B unless requested to do so by your instructor. BACKGROUND Congratulations!!! You...
-
Nathan recently interviewed with one of the accounting firms in the city where he wants to live. The firm agreed to cover the expense of a rental car that he used to travel from his university to the...
Study smarter with the SolutionInn App