Why does matlab not evaluate equations properly?

I'm trying to evaulate taylor series at x = 6.42855, however with my equation it does not evaluate it at that point and just outputs the taylor series. What should i do to fix it? Anyone able to write a better code for this?

댓글 수: 1

Hi Lin Wu,
As per my understanding, you want to evaluate the Taylor expansion at a particular point.
Here is how you can modify your code:
clearvars
clc
syms x
f = log(0.7*x+0.5);
x0 = 4.2857;
t0 = taylor(f,x,x0,'Order',2);
h = subs(t0,x,6.42855);
You can refer to the following link for documentation of Taylor expansion in MATLAB

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

 채택된 답변

David Hill
David Hill 2022년 6월 20일
편집: David Hill 2022년 6월 20일
syms x
f=log(.7*x+.5);
x0=4.2857;
t=taylor(f,x,x0,'Order',2);
a= double(subs(t,6.42855))
a = 1.6813

추가 답변 (1개)

Torsten
Torsten 2022년 6월 20일
syms x
f = log(0.7*x+0.5);
x_0 = 4.2857;
t0 = taylor(f,x,x_0,'Order',2);
h = matlabFunction(t0);
h(6.42855)
ans = 1.6813
log(0.7*6.42855+0.5)
ans = 1.6094

카테고리

제품

질문:

2022년 6월 20일

댓글:

2022년 6월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by