I need to construct a code that finds solution to a set of equation by domain decomposition. it should be really easy, but I'm just not really an expert in while/for loops, so I need help with this, and I rely appreciate it. I try to explain the problem as best as I can here: so let's say we have 3 equations with 3 unknowns for example a=[2,3,0;4,5,6;0,2,3] and a*x=b with b=[9;2;5] , so I come up with an initial guess for x_2 so we can call it x_0_2, and then MATLAB should run this through a loop/while to do the followings : from the first equation it should solve for x_1_1 which is equal to (9-3*X_0_2)/2 and then solve for x_1_3 by using the third equation as follows x_1_3 = (5 - 2*X_0_2)/3 and then use those two and solve for new x2 which is x_1_2 = (2- 4*x_1_1 - 6*x_1_3)/5 by the second equation, and then give me a matrix with [x_1_1; x_1_2 ; x_1_3] and then it keeps doing this and it will give me [x_2_1; x_2_2 ; x_2_3] until it reaches a limit and I will define that limit in while loop . I think I know how to define that limit, but I need help with writing this process. Thanks
No products are associated with this question.
There is no reason to suppose that such a procedure as you describe will converge properly to a solution. It all depends on the element values in 'a' and 'b'. I hate to see you spend so much time on a method that may not work, when matlab makes available to you a very easy method for solving it using the 'backslash' operator:
x = a\b;
Play games and win prizes!Learn more