e^x/x

17 ビュー (過去 30 日間)
ahmed
ahmed 2016 年 12 月 25 日
回答済み: John BG 2016 年 12 月 25 日
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) ;

採用された回答

John BG
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 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by