Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: string 2 number
Date: Thu, 1 Apr 2010 16:09:04 +0000 (UTC)
Organization: Battelle Energy Alliance (INL)
Lines: 35
Message-ID: <hp2gf0$sdk$1@fred.mathworks.com>
References: <hp12km$ojf$1@fred.mathworks.com> <hp27jv$p2p$1@fred.mathworks.com> <hp2csm$r30$1@fred.mathworks.com> <hp2dt6$ekj$1@fred.mathworks.com> <hp2f0k$3tb$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 1270138144 29108 172.30.248.38 (1 Apr 2010 16:09:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 1 Apr 2010 16:09:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: news.mathworks.com comp.soft-sys.matlab:622656

"Ender " <jr147@msstate.edu> wrote in message 
> I am not sure what you mean by accessing it. I am assuming you mean when call the variable or display the solution. Whenever I ask to display the solution, MATlAb returns my solution as a string still containing my variable names. I want MATLAB to plug in the value for "x_1" and calculate the equation in the matrix.
> 
> e.g Matlab display this:
> 
> F_x =
>  
>                                 3*x_1-cos(x_2*x_3)-1/2
>                   x_1^2-81*(x_2+1/10)^2+sin(x_3)+53/50
>  exp(-x_1*x_2)+20*x_3+5332248173269055/562949953421312
>  
> J_x =
>  
> [                  3,   sin(x_2*x_3)*x_3,   sin(x_2*x_3)*x_2]
> [              2*x_1,      -162*x_2-81/5,           cos(x_3)]
> [ -x_2*exp(-x_1*x_2), -x_1*exp(-x_1*x_2),                 20]
>  
>  
> I want the numerical result not the equations.
> 
> --Ender--



Then there is more to the story than you have given, because when I copy and paste your code, I get an error (as I, and Jan, expect).



% Initial approximation
XO = [0.1;0.1;-0.1];

                f1 = 3*x_1-cos(x_2*x_3)-1/2;
??? Undefined function or variable 'x_1'.       

Undefined, because it is accessed before it is defined!  So what have you left out?