Question: With MATLAB, a) Write a FUNCTION called mySINE to be used as such: y = mySINE(x) to compute the values of sin(x) correct to three
With MATLAB,
a) Write a FUNCTION called mySINE to be used as such: y = mySINE(x)
to compute the values of sin(x) correct to three decimal places.
Use the Taylor series below to do this. How many terms will you need
to make sure that the result is accurate to three decimal places?
sin(x) = x - x^3/3! + x^5/5! + ...
- Prepend the function header below to your function and fill in the
details as instructed.
USE THIS HEADER TEMPLATE FOR ALL FUNCTIONS!
b) Write a SCRIPT that compares mySINE() to MATLAB's function sin()
- On a SINGLE plot display the sin from 0 to 2pi using each function
Color MATLAB's sin() function using RED
Color your mySINE() function using BLUE
- Create a second plot showing the difference between the two functions
FUNCTION HEADER EXAMPLE PREPEND THIS TO EVERY FUNCTION
ENTER FUNCTION NAME HERE ENTER TEXT DESCRIBING WHAT THE FUNCTION DOES Usage: function [ output_args ] = Untitled2( input_args ) Where: input_args = LIST AND DESCRIBE THEM output_args = LIST AND DESCRIBE THEM
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
