Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
im ridiculous...i wrote this 34 years ago and now i cant figure it out !!!! this is for solving n linear equations with n unknowns
 one year ago
 one year ago
im ridiculous...i wrote this 34 years ago and now i cant figure it out !!!! this is for solving n linear equations with n unknowns
 one year ago
 one year ago

This Question is Closed

mukushlaBest ResponseYou've already chosen the best response.0
function G =GJ(a,b) w=length(a); if size(a,1)~=size(a,2) disp('This is not a n*n system!!!'); else for j=1:w for i=1:w if a(i,j)~=0 l(j)=i; end end end end c=[a b]; for m=1:w cm=c(m,:); c(m,:)=c(l(m),:); c(l(m),:)=cm; for n=1:w if l(n)==m l(n)=l(m); end end end for i=1:w1 for j=i+1:w cj=c(j,:); ci=c(i,:); cj=cj(c(j,i)/c(i,i))*ci; c(j,:)=cj; end end for i=w:1:2 for j=i1:1:1 cj=c(j,:); ci=c(i,:); cj=cj(c(j,i)/c(i,i))*ci; c(j,:)=cj; end end for i=1:w x(i)=c(i,w+1)/c(i,i); end c fprintf('%f\n',x);
 one year ago

mukushlaBest ResponseYou've already chosen the best response.0
any better ideas for that
 one year ago

mukushlaBest ResponseYou've already chosen the best response.0
yes GaussJordan method
 one year ago

experimentXBest ResponseYou've already chosen the best response.0
Hold on ... let me run!!
 one year ago

experimentXBest ResponseYou've already chosen the best response.0
what type of input does function take?
 one year ago

mukushlaBest ResponseYou've already chosen the best response.0
a=n*n matrix b=1*n matrix
 one year ago

mukushlaBest ResponseYou've already chosen the best response.0
hold on man its not working :) i thought its right
 one year ago

experimentXBest ResponseYou've already chosen the best response.0
do you put symbolic values for b?
 one year ago

experimentXBest ResponseYou've already chosen the best response.0
OH .. hell. I've been so forgetful.
 one year ago

experimentXBest ResponseYou've already chosen the best response.0
Shouldn't this be easy ... since matlab stands for Matrix Laboratory still you managed to code it all. You should have done it in C perhaps ... lol. just joking.
 one year ago

experimentXBest ResponseYou've already chosen the best response.0
you might be interested in this http://projecteuler.net/
 one year ago

phiBest ResponseYou've already chosen the best response.0
I assume you know \ Backslash or left matrix divide. A\B is the matrix division of A into B, which is roughly the same as INV(A)*B , except it is computed in a different way. If A is an NbyN matrix and B is a column vector with N components, or a matrix with several such columns, then X = A\B is the solution to the equation A*X = B computed by Gaussian elimination. A warning message is printed if A is badly scaled or nearly singular. A\EYE(SIZE(A)) produces the inverse of A. Just for giggles: % gaussian elimination (not sophisticated) % ASSUMES square N x N matrix % tries not to divide by 0, but does not swap rows % create a 3x3 and a 3x1 a= rand(3); b= rand(3,1); c= [a b] % create the augmented matrix N= length(a); for ii=2:N jj= ii1; % the pivot is c(jj,jj) on the diagonal c(1,1) is the 1st pivot % the next statement creates a submatrix (using an outer product) by % the key position (the position that will be zeroed out) for each % row. All positions below the pivot will be zeroed out by the % following statement. if (abs(c(jj,jj))>1e12) % if nonzero use this pivot x= c(ii:end,jj)/c(jj,jj) * c(jj,jj:end); c(ii:end,jj:end)= c(ii:end,jj:end)  x; end; end; % Now work backwards. First normalize the pivot position to 1 % Then zero out all entries above the pivot position for jj=N:1:1 ii= jj1; if (abs(c(jj,jj))>1e12) % if nonzero use this pivot c(jj,jj:end)= c(jj,jj:end)/c(jj,jj); x= c(1:ii,jj) * c(jj,jj:end); c(1:ii,jj:end)= c(1:ii,jj:end)  x; end; end; c(:,N+1:end) a\b % compare to Matlab's gaussian
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.