The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Problem with a for loop
Replies: 1   Last Post: Oct 26, 2012 3:22 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Giorgio Monti

Posts: 2
Registered: 10/25/12
Problem with a for loop
Posted: Oct 25, 2012 10:59 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I'm a student and I need help on this case:

I have a matrix "V" with N = 100 rows and T = 30 columns which describes the value of a fund for 30 years. The expenditure that the fund have to do for the next year should be the arithmetic mean of the last three years fund's value. This is inside a for loop, so i have to do this for 30 years (T), N times.

I tried the code below, but it does'nt work:

for t = 1: T
E (1: N, t +1) = (mean (V (1: N, t: t-2), 2)));

Can you help me?


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.