|
On Mar 18, 5:31 pm, "William Smith" <w...@commoditymodels.com> wrote:
> matlab_learner <cib...@gmail.com> wrote in message <91bf19f3-7065-4fe4-a6e5-1b7395c3e...@w27g2000pre.googlegroups.com>...
> > hi all
> > i want to eliminate the for statement...but the boundaries need to be
> > fixed. is there a better way of writing this? i am using matlab.
> > thanks
>
> > d(1) = fi(2) - a*fi(1);
> > d(79) = fi(80) - c*fi(81);
> > for i = 3:79
> > d(i) = fi(i-1)
> > end
>
> > where a and c are scalars.
>
> How about d(3:79) = fi(2:78).
>
> But why are you setting d(79) in the for loop and in the previous line as well?
The problem is best solved in C. Using Matlab I am forced to shift my
index by 1
|