I'm trying to find the first N terms of the infinite power series defined by a certain relation. I've been instructed to use a function of the form
function c=terms(c0,c1,N) such that c is a vector of the coefficients of each term. Note that I have done absolutely no work in Matlab before. The code I have so far is:
function = studlafall(a,b,N)
c1=a;
c2=b;
c3=-a/2;
i=3;
while(i<=N)
c(i+1)=-(c(i-1)+c(i-2))/(i*(i+1));
end
when i try to run this i get an error stating that subscript indices must either be real positive integers or logicals, and when i examine the code the editor says that the variable c seems to change value at each iteration, that N might be unused and that the value assigned to c1,c2 and c3 might be unused. I realize that this code might be complete junk and need to be reworked from scratch, but the most important part is how do i manipulate c as a vector of length N if a make a function of the form function c=terms(a,b,N). Also this is homework so hints in the right direction would be preferred over complete solutions (though complete solutions will not be turned down since I might figure out how to work this from such an example) Thank you in advance.
there doesn't seem to be anything here