Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Change symbols back to numbers
Date: Thu, 21 Oct 2010 22:28:03 +0000 (UTC)
Organization: University of Southern California
Lines: 26
Message-ID: <i9qepj$a54$1@fred.mathworks.com>
References: <i9q820$3h$1@fred.mathworks.com> <i9qe1b$mch$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1287700083 10404 172.30.248.38 (21 Oct 2010 22:28:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 21 Oct 2010 22:28:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2407567
Xref: news.mathworks.com comp.soft-sys.matlab:680345

"John " <jrazzano@usc.edu> wrote in message <i9qe1b$mch$1@fred.mathworks.com>...
> "Sheida " <s.d.not.this@gmail.com> wrote in message <i9q820$3h$1@fred.mathworks.com>...
> > Hi I am trying to solve an equation (to eventually put in a loop). However, after I take care of the differentiating, I cannot replace the symbols with actual numbers. Could someone please help me? 
> > Here is what my m file looks like: 
> > syms u1 u2
> > f = [(u1^3) - u2; (u2^3) - u1];
> > u = [u1;u2];
> > J = jacobian(f,u);
> > Ji = inv(J);
> > b = Ji*f;
> >  u1 = 2;
> >  u2 = 1;
> >     u = u - b
> > 
> > my result for "u" is:
> > u =
> >  
> >  u1 + (u1 - u2^3)/(9*u1^2*u2^2 - 1) + (3*u2^2*(u2 - u1^3))/(9*u1^2*u2^2 - 1)
> >  u2 + (u2 - u1^3)/(9*u1^2*u2^2 - 1) + (3*u1^2*(u1 - u2^3))/(9*u1^2*u2^2 - 1)
> > 
> > I want matlab to replace all u1s with 2 and all u2s with 1. I have been searching for the past couple of hours and have not found anything. It doesn't seem like it is too hard but I just cant figure it out! 
> > Thanks! 
> 
> I dont have the symbolic toolbox but this might work. If you can convert "u" to a character array (im not sure if that is possible at all) then you can regexprep to replace the values you want, then evaluate it with eval also, hope that helps

i believe that the 'char' function will convert a sym to a string