PDA

View Full Version : A Simple Matlab Query


navjotjsingh
17-10-2005, 11:23 PM
I made a function file in MATLAB 6.5 - compound.m as


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


>> [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
18-10-2005, 03:10 PM
function [captial,interest] = compound(capital,years,rate,timescomp);

See this line , You have mis-spelled 'capital'... you have typed 'captial' instead of 'capital'

navjotjsingh
18-10-2005, 04:27 PM
Thanks a lot. Why I could not figure it out? I am so stupid!

champ_rock
20-10-2005, 01:08 PM
whats matlab for????? for what is it used

navjotjsingh
20-10-2005, 05:32 PM
Matlab is used for doing complex mathematical calculation. More about matlab at www.matlab.com or www.mathworks.com