Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
fzero zero for equation containing Psi

Subject: fzero zero for equation containing Psi

From: edward kabanyas

Date: 18 Jun, 2011 21:47:04

Message: 1 of 3

Hi All,

Is it possible to use fzero for equation containing Psi ? I want to solve the following equation:

f=@(x)log(x+1)-psi(x+1)-1.19418254968093;
x = fzero(f,2);

expected result x = 2, but fzero gives -0.472478094008077

Thanks for help

Subject: fzero zero for equation containing Psi

From: Roger Stafford

Date: 18 Jun, 2011 23:03:04

Message: 2 of 3

"edward kabanyas" <djuky_hmi@yahoo.com> wrote in message <itj6co$sui$1@newscl01ah.mathworks.com>...
> Hi All,
>
> Is it possible to use fzero for equation containing Psi ? I want to solve the following equation:
>
> f=@(x)log(x+1)-psi(x+1)-1.19418254968093;
> x = fzero(f,2);
>
> expected result x = 2, but fzero gives -0.472478094008077
>
> Thanks for help
- - - - - - - - -
  Fzero's answer looks just about right. The value of f(2) is well away from zero. Try plotting your f(x) between x = -.7 and 3.

Roger Stafford

Subject: fzero zero for equation containing Psi

From: Steven_Lord

Date: 20 Jun, 2011 03:56:07

Message: 3 of 3



"edward kabanyas" <djuky_hmi@yahoo.com> wrote in message
news:itj6co$sui$1@newscl01ah.mathworks.com...
> Hi All,
>
> Is it possible to use fzero for equation containing Psi ? I want to solve
> the following equation:
>
> f=@(x)log(x+1)-psi(x+1)-1.19418254968093;
> x = fzero(f,2);
>
> expected result x = 2, but fzero gives -0.472478094008077

FZERO is one function for which it's extremely easy to check the results. Is
f(x) small? If so, then FZERO has returned a correct answer.

When I evaluate the code above and then compute f(x) it's
approximately -eps, which is pretty small. In contrast, f(2) is around -1.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us