Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Note: There is 4 pictures I posted this question to chegg but someone answered it by hand, and cant hardly read what they wrote and

Note: There is 4 pictures image text in transcribed
image text in transcribed image text in transcribed image text in transcribed
I posted this question to chegg but someone answered it by hand, and cant hardly read what they wrote and they did not verify it worked since they didnt use Matlab software. Please type it in matlab code in Matlab software. Thank you
Answer in matlab code and verify it works by showing part of the answers working. Please use comments to know what is your thinking as you work on the problem. The assignment is one whole assignment that problem 1 needs to be solved to be able to solve the second problem. Note: there is three different pictures with information. Use methods describe under OBJECTIVES: and the other ones described in the instructions. Thankyou .Learn how to solve linear systems using the following methods: o MATLAB left division (Gauss elimination) o LU Factorization o Gauss-Seidel Iteration .Learn how to test for round off error problems. INSTRUCTIONS: Write a single MATLAB m-file that solves all problems below. For each problem, write the requested answers to ASCII data files with the exact filenames specified (e.g. "A3.dat"). Submit a printout of your main m-file and all associated m-files me for grading by the due date. For (e.g. "Al.dat"), submit those to me in an email! (This will save on paper.)Your entire assignment shou generating all of the required data files, by typing the name of the main m-file at the command prompt. the data files you generate Problem 1 Consider the electric circuit shown below: V4 R7 V2 R8 R6 R1 12 R3 R4 V1 R2 R5 V3 By applying Kirchoft's Laws and Ohm's law, the currents l,. /2. /s, and Ii can be solved for with the following linear system: Page 1 of 3 The resistors and voltages have the values given in the table below: Resistor Value( 150 1000 R, I 15000 3000 500 2000 100 80 Variable -40 60 Rs Work by hand to write this system of linear equations in standard matrix form Ax b where x is the column vector of the four unknown currents (i, 1, Is, and 4) and all of the values on the diagonal of A are positive. Calculate the 2-norm condition number of the coefficient matrix A. Note that this step is intended as a check to make sure you have formulated A correctly in addition to giving an indication of the roundoff error potential. a) b), Varying V2 from 0 to 120 in increments of 0.5, calculate I, 12.Is, and I, using left division. Save your results in a matrix of 4 columns (results for /i. 12.1s, and 1 respectively) and 241 rows. Repeat the calculation for part (b) using LU factorization to increase the efficiency of the calculation. Also, for each value of V2, save the intermediate solution (the d vector resulting from the forward substitution step) as a row in a 241 x4 matrix for submission to Scorelator. c) Consider timing sections of your code using the tic and toc commands to measure the computational efficiency gained by using LU factorization. ANSWERS: Write your result for the condition number (1x1) to Al.dat. Write your current results (241x4) for parts (b) and (c) to A2.dat and A3.dat respectively. Write your matrix of intermediate d vectors (241x4) to A4.dat. Consider again the linear system from Problem 1. Note that once the system above is rearranged the matrix A is diagonally dominant. a) Repeat the calculation you did for problem lb using Gauss-Seidel iteration (use GS. m or your own version) to solve the linear system for each V2 value. Use an initial guess of I [0, 0, 0, O] for all cases and use a stopping criterion of E, IE-4 Page 2 of 3 b) Repeat the calculation for part (a) using Jacobi iteration. You will need to write your own function to do this iteration (you can modify GS.m with only one or two small changes depending on how you do it). Use anin itial guess of I-|0, 0, 0, 0] f solutions may take more than 50 iterations each to converge. or all cases and use a stopping criterion of Eq- IE-4. Note that these c) For the two iterative solutions for parts (a) and (b), determine the average number of iterations required for convergence in each case. Save your result in a two-element row vector (Gauss-Seidel first, Jacobi second). Calculate the Euclidean norm of the residuals vector for each of the Gauss-Seidel solutions and store the results in a column vector (241x1). d) ANSWERS: Write your results (241x4) for parts (a) and (b) to A5.dat and A6.dat respectively. Write your average iteration counts from part(c) to A7.dat (1x2). Write your vector of residuals norms from part (d) to A8.dat (241xI)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions