From: James on 15 Apr 2010 10:35 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hq2eih$5ti$1(a)fred.mathworks.com>... > "James " <cche5398(a)uni.sydney.edu.au> wrote in message <hq2b0m$gm2$1(a)fred.mathworks.com>... > > > > for i = 180:-1:-180 > > ra(i) = f(i).*g(i) > > end > > If you do that, you should (re)read the "Getting Started" doc. > > - First: don't confuse between index of an array (must be integer, started from 1, used in RA), and input of a functions (used in F and G). > - If you want to store the values of RA with respect to I, you should store both ARRAYS parametrized by the *common* index, as following: > > i = 180:-1:-180; > for ind=1:length(i) % ind will be the common index > ra(ind) = f(i(ind))*g(i(ind)); > end > > % OR better still, the Matlab-style-vectorize compact code: > > i = 180:-1:-180; > ra = f(i).*g(i); > > Bruno Thanks, Bruno.
First
|
Prev
|
Pages: 1 2 3 Prev: display figures in matlab distributed computer server Next: colormap help |