Hi, so I'm trying to get the n values to multiply each values in the P matrix in order to get the compound interest values, but I'm getting this error, how can I fix this?

 채택된 답변

David Hill
David Hill 2022년 2월 12일

0 개 추천

Use the code box!
n=[1,3,16];
P=[300 400 500 700 1000]';%transpose
t=4;
y=P.*(1+t/100).^n-P;

댓글 수: 3

Sherman Ng
Sherman Ng 2022년 2월 12일
So the question is: Create the matrix based on the principals of [300 400 500 700 1000] and the interest rate 0.04.
So your code partially worked but it only gave me the y value for the principal of 300.
Not true.
y =
12.0000 37.4592 261.8944
16.0000 49.9456 349.1925
20.0000 62.4320 436.4906
28.0000 87.4048 611.0869
40.0000 124.8640 872.9812
Oh never mind I see what you mean. I got it to work.
For some reason I though this was needed.
Year_1=y(1);
Year_3=y(2);
Year_16=y(3);
T=table(Year_1 , Year_3, Year_16);

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2022년 2월 12일

댓글:

2022년 2월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by