Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: mpower input to eig must not contain nan or inf
Replies: 7   Last Post: Nov 14, 2012 10:10 AM

 Messages: [ Previous | Next ]
 Steven Lord Posts: 18,038 Registered: 12/7/04
Re: mpower input to eig must not contain nan or inf
Posted: Nov 14, 2012 10:10 AM

"Carl S." <tkittler@gmail.com> wrote in message
news:k7ti4t\$sio\$1@newscl01ah.mathworks.com...
> "Carl S." wrote in message <k7thre\$rdd\$1@newscl01ah.mathworks.com>...
>> Alan_Weiss <aweiss@mathworks.com> wrote in message
>> <k7tgil\$msj\$1@newscl01ah.mathworks.com>...

>> > On 11/13/2012 7:32 AM, Carl S. wrote:
>> > > "Carl S." wrote in message
>> > > <k7te95\$f2o\$1@newscl01ah.mathworks.com>...

>> > >> Hi,
>> > >>
>> > >> I want to compute the derivative of 10^-2*s when s<1 and s>0
>> > >>
>> > >> So, I wrote this :
>> > >> 10^(-2*s))*log(10)*(-2)
>> > >>
>> > >> But I am getting the error : "mpower input to eig must not contain
>> > >> nan or inf"
>> > >>
>> > >> How can I solve this error ?
>> > >> Carl

>> > >
>> > > The equation which I want to compute its derivative is 10^(-2*s)

>> >
>> > To perform symbolic computation you need Symbolic Math Toolbox, and you
>> > must declare your variable as symbolic.
>> >

>> > >> syms s
>> > >> fcn = 10^(-2*s)

>> >
>> > fcn =
>> >
>> > 1/10^(2*s)
>> >

>> > >> diff(fcn)
>> >
>> > ans =
>> >
>> > -2/10^(2*s)*log(10)
>> >
>> > Alan Weiss
>> > MATLAB mathematical toolbox documentation

>
> Thanks Alan. My codes are now;
>
> s=sqrt(phi_x.^2 + phi_y.^2); a=(s>=0) & (s<=1);
> b=(s>1);
> ps= a.*((-2/10^(2*s))*log(10))+b.*(s-1);
>
> But, I am getting this error : "mrdivide Matrix dimensions must agree" :(

Change:

(-2/10^(2*s))

to:

(-2./10.^(2*s))

to perform _elementwise_ exponentiation and division instead of the _matrix_
forms of those operations.

--
Steve Lord
slord@mathworks.com
http://www.mathworks.com

Date Subject Author
11/13/12 Tony Kittler
11/13/12 Tony Kittler
11/13/12 Alan Weiss
11/13/12 Tony Kittler
11/13/12 Tony Kittler
11/13/12 Alan Weiss
11/13/12 Tony Kittler
11/14/12 Steven Lord