navjotjsingh
Wise Old Owl
I made a function file in MATLAB 6.5 - compound.m as
I now called the function as
Can somebody tell me the reason for error and how should i rectify it?
Code:
function [captial,interest] = compound(capital,years,rate,timescomp);
% COMPOUND: function to compute the compounded capital and the interest
% call syntax:
% [capital,interest] = compound(capital,years,rate,timescomp);
% ------------
x0 = capital; n = years; r = rate; k = timescomp;
if r>1
disp('check your interest rate. For 8% enter .08 not 8.')
end
capital = x0*(1+r/k)^(k*n);
interest = capital - x0;
I now called the function as
Code:
>> [c,in]=compound(1000,5,0.06,4);
[color=red]??? One or more output arguments not assigned during call to 'compound'.[/color]
Can somebody tell me the reason for error and how should i rectify it?