Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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

Hi,

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?

Thanks



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.