Ask your own question, for FREE!
Mathematics 25 Online
OpenStudy (anonymous):

Matlab could someone help me write the code %want to store the particular solution in xp. initialize xp set it to be the zero column vector with decent dimension using the pivot columns from A generate pA solve for pA*temp=b where temp is a temporary vector using pA\b put temp in the positions of xp output xp

OpenStudy (anonymous):

function csolve(A,b) [x,z]=size(A); pivot=[]; free=[1:1:z]; rreform = rref(A); for i=1:1:x for j=1:1:z if (rreform(i,j)==1) pivot=[pivot,j]; break; end end end free(pivot)=''; rank = length(pivot); fprintf('the rank of the coefficent matrix is %d.\n',rank); fprintf('the pivot variables are'); for i=1:1:length(pivot) fprintf('x%d',pivot(i)); end fprintf('.\n'); fprintf('the free variables are'); for j=1:1:length(free) fprintf('x%d',free(j)); end fprintf('.\n'); end

OpenStudy (anonymous):

this is my current code runs and works fine

OpenStudy (usukidoll):

*runs*

OpenStudy (anonymous):

? @UsukiDoll

OpenStudy (usukidoll):

I'm not too good at matlab...I'm just happy that I passed Deterministic Modeling a.k.a Mathematical Biology and I don't have to do matlab.

OpenStudy (anonymous):

oh ok:/ @UsukiDoll

OpenStudy (usukidoll):

sorrrrrrrrry D:

OpenStudy (anonymous):

its ok! @UsukiDoll im sure someone will help lol

OpenStudy (usukidoll):

usually it's @dan815 or @Kainui who are good at matlab but they never seem to respond and all the other matlab helpers don't show up here that often :/ But I think there's a site called stackoverflow that has online help for matlab

OpenStudy (anonymous):

oh okay ill try that thanks!

OpenStudy (usukidoll):

http://stackoverflow.com/questions/tagged/matlab

OpenStudy (dan815):

Hi, still need help?

OpenStudy (anonymous):

yes please @dan815

OpenStudy (dan815):

and what do you have left to do?

OpenStudy (unklerhaukus):

if you like a nice print you might want spaces: ` ...variables are ');` | here and some commas, | ``` ... fprintf('x%d, ... end fprintf('\b\b.\n') ... ``` using `\b` to delete the last comma (backspace)

OpenStudy (unklerhaukus):

@lljenjenll, the code you have posted does seems to work fine, but it hard to see how it matches with the question, all the variable names are different

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!