I'm having trouble trying to store my values into a variable. The question of this is:
A necklace is appraised at $2200. THe value of the neclace increases at an anhnual rate of 4%, so one year from today the necklace will be worth $$2288.
Use a for loop to determine how much the necklace will be worth eacy year from now until 15 years from today. Store the values in a vector called "value".
This is what I have so far, but I need to store the following 1:15 in the value.
value = 2200;
for n=1:15
2200*1.04^n
end

답변 (1개)

VBBV
VBBV 2021년 4월 14일

1 개 추천

%f true
value = 2200;
for n=1:15
V(n) = value*1.04^n
end

댓글 수: 1

building off of your thing which didn't work as V wasn't defined, I did this and it worked:
for n=1:16
value(n)=2200*1.04^(n-1)
end

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

카테고리

도움말 센터File Exchange에서 Random Number Generation에 대해 자세히 알아보기

제품

질문:

2021년 4월 14일

댓글:

2021년 4월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by