how i can write a MATLAB function with three inputs

i need help on this
INTEREST = money*.025
display the total INTEREST
test your program for three inputs : 400 800 1200
the output =
totalINTEREST = 60
how can i find the total INTEREST of an numbers of accounts ?

Respuestas (1)

Ameer Hamza
Ameer Hamza el 13 de Nov. de 2020
Given a vector
x = [400 800 1200]
You can multiply it with the interest factor to get individual interests
x_interest = x*0.025;
and calculate total interest
interest_total = sum(x_interest)

2 comentarios

ok thanks , but how can i do it in using m file ?
Yes, you can just write these lines in a function. Since this is a homework problem, so I cannot give an exact answer but here is a useful link

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with MATLAB en Centro de ayuda y File Exchange.

Preguntada:

el 13 de Nov. de 2020

Comentada:

el 13 de Nov. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by