How do I make a function?
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
I can't make simple equations like F=P(1+i)^n, i= interest rate, P=initial money, n=years, F=profit. In my assignment I need to make a table that displays values of n (from 1 to 9) and F side by side, with P and i being any numbers (for example, I was using 1000 and .05).
댓글 수: 0
답변 (1개)
James Tursa
2018년 9월 5일
편집: James Tursa
2018년 9월 5일
You can use a function handle for this. E.g.,
F = @(n) P*(1+i).^n
I'll leave it to you to plug in appropriate values and form your output table.
댓글 수: 0
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!