Path: news.mathworks.com!not-for-mail
From: Alan Weiss <aweiss@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: eigen values equation
Date: Mon, 22 Feb 2010 12:59:17 -0500
Organization: The MathWorks, Inc.
Lines: 79
Message-ID: <hlugll$bhi$1@fred.mathworks.com>
References: <hlmelk$jd9$1@fred.mathworks.com> <hlml7p$rgm$1@fred.mathworks.com> <hlmoo6$eqe$1@fred.mathworks.com> <hltv3t$ih6$1@fred.mathworks.com> <hluc5e$8j0$1@fred.mathworks.com>
NNTP-Posting-Host: weissa.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1266861557 11826 172.31.57.141 (22 Feb 2010 17:59:17 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 22 Feb 2010 17:59:17 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
In-Reply-To: <hluc5e$8j0$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:610551

Ender wrote:
> Alan Weiss <aweiss@mathworks.com> wrote in message 
> <hltv3t$ih6$1@fred.mathworks.com>...
>> Sorry, I misspoke. Here's what I meant:
>>
>> %Your setup
>>  >> syms lamda
>>  >> Ident_matrix = lamda*eye(3);
>>  >> A = [0,-.75,0;-0.75,0,0.25;0,0.25,0];
>>  >> Result = A-Ident_matrix;
>>  >> eq = det(Result);
>>
>> %solve
>>  >> s = solve(eq)
>>
>> s =
>>
>>                      0
>>   -(2^(1/2)*5^(1/2))/4
>>    (2^(1/2)*5^(1/2))/4
>>
>> %Take the second element for example
>>  >> s(2)
>>
>> ans =
>>
>> -(2^(1/2)*5^(1/2))/4
>>
>> %square it if you like
>>  >> s(2)^2
>>
>> ans =
>>
>> 5/8
>>
>> Does this help?
>>
>> Alan Weiss
>> MATLAB mathematical toolbox documentation
>>

> 
> Thanks, that worked, but know I have a slightly less complicated 
> problem. I need to convert the result back into decimal form. I am using 
> the value for "s" in another calculation however I would like to see the 
> result of that calculation in decimal format. Here is my algorithm:
> 
> syms lamda
> 
> % Make the identity matrix
> Ident_matrix = lamda*eye(3);
> 
> A = [0,-.75,0;-0.75,0,0.25;0,0.25,0];
> 
> Result = A-Ident_matrix;
> 
> % Find the rho(T-j) value
> 
> eq = det(Result);
> 
> s = solve(eq)
> s
> 
> rho = s(3)^2
> % rho = str2num('s(3)^2')
> % omega =2/(1+sqrt(1-(rho)^2))
> 
> 
> I have tried "str2num" and "rats" however "str2num" gives me an empty 
> matrix, and "rats" does not change the format. Is there a fraction to 
> decimal command in MATLAB?
> 
> --Ender--

The result s(3)^2 is a symbolic object. Convert it to double with the 
"double" command.

Alan Weiss
MATLAB mathematical toolbox documentation