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:
Issues with bndyield function

Subject: Issues with bndyield function

From: Pooja

Date: 5 Apr, 2013 17:44:06

Message: 1 of 2

I'm using the bndyield function to calculate the real yield on an Australian inflation-linked security.

 bndyield(179.968, 0.04, '4/5/2013','8/20/2015',4,0,0,'5/13/1994',[],'8/20/2015','4/5/2013',[])

This should return ~ +0.00735, but is instead returning -0.2048. Why is this?

Subject: Issues with bndyield function

From: dpb

Date: 7 Apr, 2013 14:33:56

Message: 2 of 2

On 4/5/2013 12:44 PM, Pooja wrote:
> I'm using the bndyield function to calculate the real yield on an
> Australian inflation-linked security.
> bndyield(179.968, 0.04,
> '4/5/2013','8/20/2015',4,0,0,'5/13/1994',[],'8/20/2015','4/5/2013',[])
>
> This should return ~ +0.00735, but is instead returning -0.2048. Why is
> this?

Since it's negative, I'd guess the problem is the date format. I don't
see anything in the documentation about what is assumed for the various
dates as date strings as far as the format, but I'm guessing it has
interpreted the mm/dd/yyyy format that you have input as dd/mm/yyyy instead.

Try

bndyield(179.968, 0.04, ...
          datenum('4/5/2013','mm/dd/yyyy'), ...
          datenum('8/20/2015','mm/dd/yyyy'),4,0,0, ...
          datenum('5/13/1994','mm/dd/yyyy'),[], ...
          datenum('8/20/2015','mm/dd/yyyy'), ...
          datenum('4/5/2013','mm/dd/yyyy'),[])

or any other variation to ensure the dates are interpreted correctly and
see if that fixes things. Don't have toolbox so can't check directly
here...

--

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