By using syntax ‘taylor’ in MATLAB, find the third order approximation of log x using base point at x = 1.
5 views (last 30 days)
Show older comments
syms x
f = logx;
T = taylor(f, 'Order', 3)
Undefined function or variable 'logx'.
How can i do that above question? I have tried but i was unable to generate
11 Comments
Torsten
on 13 Sep 2018
Yes.
But why don't you read the documentation:
https://de.mathworks.com/help/symbolic/taylor.html
?
Your question is almost answered in the section "Specify Expansion Point".
Best wishes
Torsten.
Answers (2)
Dongji Lee
on 8 Nov 2020
Or you can type it in simple manner.
T = taylor(f,x,1,'Order', 3)
0 Comments
John D'Errico
on 12 Nov 2018
Hint: MATLAB does not know that when you type logx, in fact you wanted it to compute the function log(x). As well, you need to understand that a Taylor series of log(x) around the default expansion point of x==0 will be a serious problem. If you don't know why, then go back to calc 101.
So your code should start like this:
syms x
f = log(x);
T = taylor(f, 'Order', 3,'expansionpoint',1)
Which works nicely.
T =
x - (x - 1)^2/2 - 1
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!