A Simple Matlab Query

Status
Not open for further replies.

navjotjsingh

Wise Old Owl
I made a function file in MATLAB 6.5 - compound.m as

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?
 

144

Journeyman
Code:
function [captial,interest] = compound(capital,years,rate,timescomp);

See this line , You have mis-spelled 'capital'... you have typed 'captial' instead of 'capital'
 
Status
Not open for further replies.
Top Bottom