I am currently in the fun process of buying a house. My wife and I were going over the mortgage calculations the other day and figuring out our approximate
monthly payments and the amount of money we want to put down. We know that the financial company we are using probably knows
how to do these calculations. But we wanted to check them! I also noticed that they were using Excel so that made me curious
to see how easy this would be in my choice software for everything, MATLAB.

It's generally the case that if functionality for MATLAB seems obvious, it's probably built in to the product or one of the
toolboxes. If this is not the case, then someone else has likely already written it and deposited it on the File Exchange.
I vaguely remembered this App from a few months ago when my friend Doug and I were talking about the great low interests rates available right now.

NOTEAll numbers below have been obfuscated to hide the actual financial details.

Contents

Apps

Using MATLAB Apps you can package your GUIs and their dependencies into single files that can be distributed and installed
easily. This will help your users avoid the standard path issues. Apps also enable you to have easy version control and
descriptions for your GUIs.

Side Note: I know that during the R2012b release many of you wanted to be able to change the App icon. In R2013a, the ability to select
an icon from one of a dozen is available.

This App

So let's take a look at this App:

We'll first try 20% down:

How does that compare to 5% down (not including Private Mortgage Insurance (PMI)):

So the total interest saved by putting down 20% instead of 5% is about $28K, not including PMI.

What if we could shorten it to 15 years?

This just about halves the amount of interest!

Unfortunately, the plot does not work for any number of years less than 30 (enhancement!)

For every scenario, the numbers lined up with those that the financial firm gave us verifying both their calculations and
this App.

The Code

Though we have a big suite of Financial Products, none of them were used here. The engine behind this appears to be about
20 lines of MATLAB code and everything else is just for the GUI.

One thing I noticed is that S B did a lot of work for selecting the colors for the plot lines. Here's what he did:

2 CommentsOldest to Newest

One of the commenters asked for regular currency format. uitable does not make that easy. When converting to text, all entries are left aligned which looks ugly. Does uitable have the option to right align text? (I could not find it.)

An awkward solution is to create text numbers with leading 0’s and then replacing leading zeros with spaces. Am I overlooking something?