Answered step by step
Verified Expert Solution
Question
1 Approved Answer
function[c]= mysin(x); x; % any given value within range y = -x*x; % ; means do not print output S = 1; for n=7:-2:3 S
function[c]= mysin(x); x; % any given value within range y = -x*x; % ; means do not print output S = 1; for n=7:-2:3 S = S*y/(n-1) + 1; end S = S*x
Here is the mfile
The posted program "Horner's algorithm for sin(x)" computes sin(x) to within 0.0001 fr any x with x 2. a) Create an m-file with name mysin that executes this program when mysin(x) is typed into the command window; b) Write a matlab program that uses the program mysin(x) to compute sin(x) for all numbers x within the range of any 64 bit computer. (See p. 67-68 of the text.) c) Compare the output of your program for 2445 with the output of mathlab function sin(x). Explain any discrepencies. The posted program "Horner's algorithm for sin(x)" computes sin(x) to within 0.0001 fr any x with x 2. a) Create an m-file with name mysin that executes this program when mysin(x) is typed into the command window; b) Write a matlab program that uses the program mysin(x) to compute sin(x) for all numbers x within the range of any 64 bit computer. (See p. 67-68 of the text.) c) Compare the output of your program for 2445 with the output of mathlab function sin(x). Explain any discrepenciesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started