## matrix....gauss elimintion

### masoud mansouri (view profile)

on 29 Nov 2015
Latest activity Commented on by Geoff Hayes

### Geoff Hayes (view profile)

on 2 Dec 2015
hi ... last night i wrote complete code but if i run this ...show me errors... so could you write me complete gauss elimination for matlab...that solve 3*3 matrix fun and over there matrix. thanks i sent my code for matlab.....i will wait for you
clear all
clc
c = input ('please enter matrix :'); %matris elim zarib
disp(c);
b=input('please enter matrix :'); %ansewr matrix
disp(b);
b = b';
A = [c b];
A(2,:) = A(2,:) A(1,:)/A(1,1)*A(2,1);
A(3,:) = A(3,:) A(1,:)/A(1,1)*A(3,1);
A(4,:) = A(4,:) A(1,:)/A(1,1)*A(4,1);
A(4,:) = A(4,:) A(2,:)/A(2,2)*A(4,2);
A(4,:) = A(4,:) A(3,:)/A(3,3)*A(4,2);
x(4) = A(4,5)/A(4,4)
x(3) = (A(3,5) A(3,4)*x(4))/A(3,3)
x(2) = (A(2,5) A(2,4)*x(4) A(2,3)*x(3))/A(2,2)
x(1) = (A(1,5) A(1,4)*x(4) A(1,3)*x(3))/A(2,2) A(1,2)*x(3)-A(1,1)
x = x'
when i run on the A(2,:) = A(2,:) A(1,:) at the A between )A(1 ask me what is it? when i input * / + - it's wrong..

Geoff Hayes

### Geoff Hayes (view profile)

on 29 Nov 2015
Masoud - if you are trying to solve for a 3x3 matrix, why is x a 4x1 array? Also, please correct and comment on your code. What is the intention behind
A(2,:) = A(2,:) A(1,:)/A(1,1)*A(2,1);
There seems to be an operation missing as the above cannot be evaluated.
masoud mansouri

### masoud mansouri (view profile)

on 2 Dec 2015
@ Geoff Hayes thanks i change code and run the program run generali all n*n matrix and find x function on the matrix and gauss elimitone
Geoff Hayes

### Geoff Hayes (view profile)

on 2 Dec 2015
masoud - I don't understand your comment. Please post your updated code (that which you have changed) and indicate what (if any) problems or errors you are observing with it.