Entering a value for x in a returned equation from a Taylor series.
Show older comments
I'm taking a class and have been assigned a problem from our text. I have no problem working it with a pen and paper. I have a big problem working it in MatLab. The problem statement is use zero through third order Taylor series expansion to predict f(3) for f(x)= 25*x^3-6*x^2+7x-88 using a base point at x=1. Compute the true percent relative error for each approximation. The code I have so far does the Taylor expansion fine but I am unable to plug the value of three into the returned equations. How can I do this? My code is
function [g] = ans(y)
x=3
trueval=25*x^3-6*x^2+7*x-88
syms x
f=25*x^3-6*x^2+7*x-88
for n=(0:4)
y=taylor(f,n,1)
end
Any help would be greatly appreciated. Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!