function approx = approxCosineFunction(x, t) approx=1; for i=1:1:t-1 addterm = (-1)^i*(x^(2*i))/factorial(2*i); approx = approx + addterm; endend
MATLAB: Alternative for a for loop. How to write this code without using a for loop
for loopMATLABvectorization
Related Question
- Unable to perform assignment because the left and right sides have a different number of elements.
- Trying to use summation notation in a for loop
- Could anyone give an idea to write code to solve below problem
- Plotting summation using for loop
- Is there a command to plot unit vectors in 3D
- For loops and taylor series
Best Answer