Question
Problem 1: Write/make a MATLAB script file that uses Taylor series expansion to calculate sin(x) where x is in radians using for loop/loops element by
Problem 1:
Write/make a MATLAB script file that uses Taylor series expansion to calculate sin(x) where x is in radians using
-
for loop/loops
-
element by element operations
for x = 0 rad and h = a rad
The x-axis should have different step sizes, h written on x-axis. You can select the same step size values as used in Lecture 7b example video. Similarly, the code should be for different order of accuracies. You can select the same order of accuracies as shown in the video Lecture 7b example. The y-axis should have error.
Note: You can use a piece of paper to find Taylor series of sin(x) and double check the expression you get from a Mathematics book or online source.
Formula: f(x+h) = f(x)+h/1! f'(x)+h^2/2! f''x+h^3/3! f'''x + O(h^4)
Problem 2:
Write/make a MATLAB script file that uses Taylor series expansion to calculate cos(x) where x is in radians using
-
for loop/loops
-
element by element operations
for x = 0 rad and h = a rad
The x-axis should have different step sizes, h written on x-axis. You can select the same step size values as used in Lecture 7b example video. Similarly, the code should be for different order of accuracies. You can select the same order of accuracies as shown in the video Lecture 7b example. The y-axis should have error.
Note: Please do note that Taylor series for cos(x) and sin(x) for the same x and h are different. Note: You can use a piece of paper to find Taylor series of cos(x) and double check the expression you get from a Mathematics book or online source.
Formula: f(x+h) = f(x)+h/1! f'(x)+h^2/2! f''(x)+h^3/3! f'''(x) + O(h^4)
Problem 3:
Write/make a MATLAB script file that uses Taylor series expansion to calculate ln(x)
-
for loop/loops
-
element by element operations
for x = 1 and h = a
The x-axis should have different step sizes, h written on x-axis. You can select the same step size values as used in Lecture 7b example video. Similarly, the code should be for different order of accuracies. You can select the same order of accuracies as shown in the video Lecture 7b example. The y-axis should have error.
Note: If you want to calculate ln(x) on MATLAB you will write log(x).
Note: If you want to calculate log(x) on MATLAB you will write log10(x).
Formula: f(x+h) = f(x)+h/1! f'(x)+h^2/2! f''(x)+h^3/3! f'''(x) + O(h^4)
Step 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