The "last" digit? A little ambiguously stated. In the number 12345, is 5 the last digit you are asking about?
It looks like you already know that you can divide by 10. What happens to that last digit then? Could you find the greatest integer that does not exceed the result? How would that help you? Do you know of a function that can convert a floating point number to an integer, still in a double form? (Yes, I suppose you could also decide to cast a number to an integer class, then back into a double. That would work too.)
There are other tools you might consider too.
Perhaps the best way to learn about them would be to do this in MATLAB:
This will give you the first line of the help blocks of every function in MATLAB in the directory of elementary mathematical functions. So any of them seem like they would be helpful?
You can find the solution yourself, and if you do, you will be much farther ahead than if I tell it to you on platter. So take a look at the results of the help command I suggested. This will also teach you a way to learn other things in MATLAB. Do some exploring. I promise the solution can be found in elfun. (It is not just elves they hide in there.)
Edit: The problem has moved forward a bit. The question is now how to step foward.
My first comment is digit_sum must know when to terminate the recursion. The step forward will actually begin with knowing when to stop the recursion. Every recursive function typically has a test in the beginning, testing to see if it is done.
The logic could look like this:
function outsum = digit_sum(innum)
outsum = a + digit_sum(innum);
I've not done the actual work there, just giving you the flow. You already know the rest.
digit_sum cannot escape the recursion until it gets to the end, until the input number has nothing left to it. At that point, the recursion folds back up, one level after another.
Take a shot at that. I think you will have working code now pretty quickly. Ask again if you get closer, but still feel stuck.