By using syntax ‘taylor’ in MATLAB, find the third order approximation of log x using base point at x = 1.

조회 수: 5 (최근 30일)
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
Torsten
Torsten 2018년 9월 13일
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
melissa tan 2018년 9월 13일
I have read it but i don't really understand. Thank you so much .

댓글을 달려면 로그인하십시오.

답변 (2개)

Dongji Lee
Dongji Lee 2020년 11월 8일
Or you can type it in simple manner.
T = taylor(f,x,1,'Order', 3)

John D'Errico
John D'Errico 2018년 11월 12일
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

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by