I want the cod used and brief explnation.outine which defines the following functions (either in one 1. Write down MATLAB function su .m file or separately): ft(x) = 2(sinx) * f(x) = e* sin(x) Write then the main MATLAB program, which awal main MATLAB program, which evaluates functions for x between -4x and 4 and plot the functions. O marks) Construct a simple MATLAB function program my_factorial which calculates product of the first n positive integer numbers (i.e. find factorial n!). For full points: – Make sure you protect the code from illogical use (n must be positive integer) – Test the function by comparing with built in MATLAB function factorial(n) – Make sure you test your function for any limitations. O marks) -3. Using my_factorial function from the previous subtask, construct new MATLAB function program my sin which evaluates e* using Maclaurin expansion: x xsx? x² sin(x) = x – + – +a+ .. += x + 1)* T2k + D! x ²k+1 The number of terms in this expansion needs to be provided by the user of the function as an positive integer value and value of x must be a single numeric value and not an array of matrix. Examine numerical limitations of this function and comment on their origin. 15 marks) 1.4. Write a main MATLAB program in which yo task by comparing with MATI AR built in function sin(x). Create a var the numerical error (numerror = my- number of terms in your my_sin function the semilogy0 command more usefu LAD program in which you test the my sin function from the previous in function sin(x). Create a variable that represents um error = |my_sin – matlab sind) and then examine the effect of your my_sin function and the effect of x-axis you are using. You may tind an plot(). This displays the y-axis on a logarithmic scale. For full points: – Test your code for any limitations and comment on the – If you discovered some limitations, mak (25 marks) ons and comment on their origin nations, make sure you protect the code from them. Show transcribed image text outine which defines the following functions (either in one 1. Write down MATLAB function su .m file or separately): ft(x) = 2(sinx) * f(x) = e* sin(x) Write then the main MATLAB program, which awal main MATLAB program, which evaluates functions for x between -4x and 4 and plot the functions. O marks) Construct a simple MATLAB function program my_factorial which calculates product of the first n positive integer numbers (i.e. find factorial n!). For full points: – Make sure you protect the code from illogical use (n must be positive integer) – Test the function by comparing with built in MATLAB function factorial(n) – Make sure you test your function for any limitations. O marks) -3. Using my_factorial function from the previous subtask, construct new MATLAB function program my sin which evaluates e* using Maclaurin expansion: x xsx? x² sin(x) = x – + – +a+ .. += x + 1)* T2k + D! x ²k+1 The number of terms in this expansion needs to be provided by the user of the function as an positive integer value and value of x must be a single numeric value and not an array of matrix. Examine numerical limitations of this function and comment on their origin. 15 marks) 1.4. Write a main MATLAB program in which yo task by comparing with MATI AR built in function sin(x). Create a var the numerical error (numerror = my- number of terms in your my_sin function the semilogy0 command more usefu LAD program in which you test the my sin function from the previous in function sin(x). Create a variable that represents um error = |my_sin – matlab sind) and then examine the effect of your my_sin function and the effect of x-axis you are using. You may tind an plot(). This displays the y-axis on a logarithmic scale. For full points: – Test your code for any limitations and comment on the – If you discovered some limitations, mak (25 marks) ons and comment on their origin nations, make sure you protect the code from them.

## Expert Answer

Answer to outine which defines the following functions (either in one 1. Write down MATLAB function su .m file or separately): ft(…