Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: mpower input to eig must not contain nan or inf
Posted: Nov 14, 2012 10:10 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"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;
>
> [phi_x,phi_y]=gradient(phi);
> 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
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.