フィルターのクリア

Taylor series plotting with an exp function

2 ビュー (過去 30 日間)
Faisal Al-Wazir
Faisal Al-Wazir 2022 年 5 月 18 日
コメント済み: VBBV 2023 年 2 月 12 日
im tying to do this assignment
i think my way is wrong
syms x
t=linspace(-pi,pi,100)
fx=exp(t.^2/2)+exp(t).*cos(t)
plot(t,fx)
hold on
t4=taylor(fx,x,0,'order',5)
t7=taylor(fx,x,0,'order',8)
t10=taylor(fx,x,0,'order',11)
fplot(t4)
hold on
fplot(t8)
hold on
fplot(t10)

回答 (2 件)

Sam Chak
Sam Chak 2022 年 5 月 18 日
Hi @Faisal Al-Wazir, Like this acceptable?
syms x
f = exp(x^2/2) + exp(x)*cos(x);
T4 = taylor(f, x, 'Order', 4);
T7 = taylor(f, x, 'Order', 7);
T8 = taylor(f, x, 'Order', 8);
T9 = taylor(f, x, 'Order', 9);
T10 = taylor(f, x, 'Order', 10);
fplot([f T4 T7 T8 T9 T10])
axis([-pi pi -4 8])
  1 件のコメント
Faisal Al-Wazir
Faisal Al-Wazir 2022 年 5 月 18 日
im not sure , im waitnig for more answers

サインインしてコメントする。


VBBV
VBBV 2023 年 2 月 12 日
syms x
t=linspace(-pi,pi,100); % define 100 points
fx=exp(t.^2/2)+exp(t).*cos(t); % define function
plot(t,fx,'linewidth',2); legend('f(x)')
hold on
fx = exp(x.^2/2) + exp(x).*cos(x) % define the function again with x, since fx is 1 x 100 double array
fx = 
t4=taylor(fx,x,'order',4);
t7=taylor(fx,x,'order',7);
t10=taylor(fx,x,'order',10);
fplot([t4 t7 t10],[-pi pi])
axis([-pi pi -5 50])
grid; xlabel('x');ylabel f(x); legend show
  1 件のコメント
VBBV
VBBV 2023 年 2 月 12 日
define the function again with symbol x, since fx is 1 x 100 double array computed earlier

サインインしてコメントする。

カテゴリ

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