Dose any one know any wrong with this function?

8 vues (au cours des 30 derniers jours)
a a
a a le 24 Oct 2017
Commenté : Walter Roberson le 24 Oct 2017
Dose any one know any wrong with this function?
function [nom]=intonom(int,conv)
nom=((1+int)^(1/conv)-1)*conv;
I wanna to calculate the interest by using this calculation, but it always say wrong.
  6 commentaires
a a
a a le 24 Oct 2017
@Stephen Cobeldick what i type are: function [nom]=intonom(int,conv) nom=((1+int)^(1/conv)-1)*conv; Error: Function definitions are not permitted in this context.
how can i fixed it?
Walter Roberson
Walter Roberson le 24 Oct 2017
You have to store that code in a file named intonom.m

Connectez-vous pour commenter.

Réponse acceptée

KL
KL le 24 Oct 2017
You have to store your code in an m-file under the same name as your function, in your case intonom.m. Once you do that, on the command line, you can type
annual_interest = 0.125;
number_of_years = 8;
result = intonom(annual_intereste,number_of_years)
and then result, according to your formula, is,
result =
0.1187
  1 commentaire
a a
a a le 24 Oct 2017
I get it, thank you every one!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 関数 dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!