Question: UDF and anonymous function question. Use long format to do this question. You must create two . m files: one is a UDF function file
UDF and anonymous function question. Use long format to do this question. You must create two m files: one is a UDF function file for step b and one is a script file that includes all steps from a to e
Taylor series expansion is an infinite sum of terms that are expressed in terms of the functions derivatives at a single point. The series is often used to simply approximate a function around a point.
In this question, we are going to estimate the errors between the original function and approximate function Taylor series
You are given an original function x and its Taylor series:
xxxxxOx
points Use Matlab command to create a vector x range from to with step size of
points Create a userdefined function UDF for the defined function yx that has one input x and one output y You may name the UDF qUDF. Call this function with the input x vector created in a name the output vector as yUDF. Copy and paste the UDF code.
yxxxxx
points Create an anonymous function for the above defined function yx that has one input x and one output y You may name the anonymous function qAF Call this function with the input x vector created in a name the output vector as yanonymous. Copy and paste the script.
points Use Matlab command sqrtx to get a new vector with the input x vector created in a name the output vector as ymatlab.
points To compare the difference of two vectors A & B we can use Matlab command norm to compute norm of AB Compute the following two errors to compare our function calculations:
error normyanonymous yUDF
error normymatlab yUDF
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
