e^x/x
조회 수: 19 (최근 30일)
이전 댓글 표시
how can i plot e^x/x code
syms x;
f=exp(x)/x
t3=taylor(f, 'order',4) ;
xd=-pi:pi/20:pi;
yd=subs(f,x,xd);
td3=subs(t3,x,xd);
plot(xd,yd);
error
Error using symengine
Cannot compute a Taylor expansion of the input.
Error in sym/taylor (line 128)
tSym = mupadmex('symobj::taylor',f.s,x.s,a.s,options);
Error in exp1 (line 3)
t3=taylor(f, 'order',4) ;
댓글 수: 0
채택된 답변
John BG
2016년 12월 25일
function plot doesn't work with input type syms
Instead try the following
x=[-10:0.0001:10];
y=exp(x)./x;
plot(x,y);
axis([-10 10 -1e3 1e3])
grid on
title('e^x/x')
and the following doesn't crash
syms x x0;
y= exp(x-x0)/(x-x0)
x_tay4=taylor(y, 'order',4)
y =
exp(x - x0)/(x - x0)
x_tay4 =
(- exp(-x0)/(6*x0) - exp(-x0)/(2*x0^2) - exp(-x0)/x0^3 - exp(-x0)/x0^4)*x^3 + (- exp(-x0)/(2*x0) - exp(-x0)/x0^2 - exp(-x0)/x0^3)*x^2 + (- exp(-x0)/x0 - exp(-x0)/x0^2)*x - exp(-x0)/x0
if you find these lines useful would you please mark my answer as Accepted Answer?
To any other reader, if you find this answer of any help please click on the thumbs-up vote link,
thanks in advance for time and attention
John BG
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!