By using syntax ‘taylor’ in MATLAB, find the third order approximation of log x using base point at x = 1.
Mostra commenti meno recenti
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 Commenti
Walter Roberson
il 13 Set 2018
There is no logx function. The available logarithmetic functions are log, log2, and log10
melissa tan
il 13 Set 2018
melissa tan
il 13 Set 2018
Walter Roberson
il 13 Set 2018
The default expansion point is 0, but diff(log(x)) is infinite at 0. You need a nonzero expansion point.
melissa tan
il 13 Set 2018
melissa tan
il 13 Set 2018
melissa tan
il 13 Set 2018
Torsten
il 13 Set 2018
Usually, the order of a Taylor series means the order of the approximating polynomial for the function in question. In Matlab, 'Order' means the exponent in the O-term. Thus I suspect that you will have to choose 'Order' in the Taylor command to be 4 instead of 3:
syms x
f = log(x);
p = taylor(f,x,'ExpansionPoint',1,'Order',4)
Best wishes
Torsten.
melissa tan
il 13 Set 2018
Torsten
il 13 Set 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.
melissa tan
il 13 Set 2018
Risposte (2)
Dongji Lee
il 8 Nov 2020
Or you can type it in simple manner.
T = taylor(f,x,1,'Order', 3)
John D'Errico
il 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
Categorie
Scopri di più su Common Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!