From: Kevin on
I need to compute using the taylor series but i must also name the function, i have looked around and from what i can understand this is how i thought it needs to be done:
%x- the argument
%N – the initial number of terms in the expansion
function[x N]=ty_cos(x,N)
for x=1:N
y=feval(taylor(cos(x)))
end
end


either my understanding of this is very wrong or my coding is wrong seeign as it doesnt work, all i need to be able to do, is create the taylor series expansion of cos(x) for the amount of terms N
From: Jan Simon on
Dear Kevin!

> I need to compute using the taylor series but i must also name the function, i have looked around and from what i can understand this is how i thought it needs to be done:
> %x- the argument
> %N – the initial number of terms in the expansion
> function[x N]=ty_cos(x,N)
> for x=1:N
> y = feval(taylor(cos(x)))
> end
> end

I'm confused by this: feval(taylor(cos(x)))
cos(x) is a real number. The Taylor series of a number is a number. Most likely you want to get the Taylor series of the COS function. So I assume, you should find or calcate the formula for the Taylor series manually at first.

KInd regards, Jan
From: Kevin on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <hn5fqk$iui$1(a)fred.mathworks.com>...
> Dear Kevin!
> I'm confused by this: feval(taylor(cos(x)))
> cos(x) is a real number. The Taylor series of a number is a number. Most likely you want to get the Taylor series of the COS function. So I assume, you should find or calcate the formula for the Taylor series manually at first.
>
> KInd regards, Jan

Thank you, i realised i didnt need the feval function i had misread the explanation, i have learnt how to use the taylor function and problem is solved.