Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



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; > > [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.*(s1); > > 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



