Question: Given f(x) = cos(x), the Taylor approximation for f(x) for x near 0 can be found as x 2k for N0. Px (x) =
Given f(x) = cos(x), the Taylor approximation for f(x) for x near 0 can be found as x 2k for N0. Px (x) = (-1)^ k(2k)! 1) Write a MATLAB function that takes in a vector x and an integer N, then computes Py (x). 2) Write a MATLAB for-loop program that uses the subplot command to plot both f(x) and P(x) for N = 0,..., 5 and x = [-7, 7]. (use 3 rows and 2 columns). Be sure to use xlabel, ylabel, title, and legend. Include the label P(x) on each subplot, e.g. P(x)=1-- + x x - appears in the title. [must do 2! 4! this in a loop!!]
Step by Step Solution
3.40 Rating (153 Votes )
There are 3 Steps involved in it
The image shows a mathematical problem related to MATLAB programming The task is to write MATLAB cod... View full answer
Get step-by-step solutions from verified subject matter experts
