Originally Posted by

**george** Hey, im new to programing in matlab and am having a really hard time with it so far. Im stuck on this one problem:

Define vector xi=(i-m)/(m+3); i=1,...,(2m-1) using a single loop

could someone help me out here. im not even really sure how to start this.

I know how to do simple loops like

for i=1:1:5

x=x+8

end

but thats as far as my skills go right now.

Any help would be awesome

i posted this in the programing section too, so feel free to delete that one.

I have the following code, which may help you to learn the idea.

Code:

s=100;
k=3;
for n=1:(k+1)
x(n)=1;
end;
for n=(k+1):(s-1)
mn=mod(n,12);
if mn==0
p=-1;
elseif mn<=3
p=0;
else
p=245/1000;
end;
x(n+1)=x(n)-p*x(n-k);
end;
n=1:s
plot(n,x(n),'-rs','LineWidth',1,'MarkerEdgeColor','b','MarkerSize',2)
%n=1:(s-1)
%plot(x(n),x(n+1),'-rs','LineWidth',1,'MarkerEdgeColor','b','MarkerSize',2)
grid on;

It's better you ask stuff like this to http://www.mathhelpforum.com/math-he...uter-software/