Question: Basic MATLAB function using VECTORIZATION, and ERROR definitions You probably already know from calculus that you can write sin( Create a MATLAB function the sum
Basic MATLAB function using VECTORIZATION, and ERROR definitions You probably already know from calculus that you can write sin( Create a MATLAB function the sum of the terms up to the power xN. That is, evaluate to calculate (-1)' (k-11/2 x S(x.N)- k! -1,3.5, 23 25 2 2 2" For example, S(2,11)-2- 0.909296136 Your function must accept two inputs (x and N) and output one value representing S(x,N) What's the catch? NOWHERE in your function can you use FOR or WHILE loops, or IF commands!!! You must think how to do all calculations in a "vectorized" way, (Hint: maybe create a vector of just the odd values of k from 1 to N; then use MATLAB's element-by element math operators to create a vector in which the elements are (-1)-ila k! ; then use the sum function to add up the terms of the vector. Or, maybe you have another way of doing it. Just don't use for-while-if!!) (k-1)/2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
