how i can write a MATLAB function with three inputs

조회 수: 4 (최근 30일)
Amjed Bakhsh
Amjed Bakhsh 2020년 11월 13일
댓글: Ameer Hamza 2020년 11월 13일
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 ?

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 11월 13일
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
Amjed Bakhsh
Amjed Bakhsh 2020년 11월 13일
ok thanks , but how can i do it in using m file ?
Ameer Hamza
Ameer Hamza 2020년 11월 13일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by