Anonymous function to calculate a sum
20 views (last 30 days)
I have to write an anonymous function which calculates the following sum for a given real number x and a positive integer:
x + (x^2)/2! + (x^4)/4! + ... + (x^2n)/(2n)!
I started off with this:
ch = @(x,n) ...
But I don't know how I can calculate the sum with only the anonymous function.