Need help in Taylor Series

4 Ansichten (letzte 30 Tage)
João Carvalho
João Carvalho am 21 Okt. 2017
Kommentiert: João Carvalho am 22 Okt. 2017
How can I ask the user for a term N to calculate the Taylor Serie (image) and then to ask if he wnats the sinh x or cosh x? Thanks

Akzeptierte Antwort

Birdman
Birdman am 21 Okt. 2017
deg=input('Enter the degree\n');
funcType=input('Enter 1 for sinhx, 2 for coshx\n');
syms x m
f=x^m/factorial(m);
if(funcType==1)
for n=1:2:deg
f(n)=x^n/factorial(n);
end
end
if(funcType==2)
f(1)=1;
for n=2:2:deg
f(n)=x^n/factorial(n);
end
end
  1 Kommentar
João Carvalho
João Carvalho am 22 Okt. 2017
And the result should be calculated and shown in the range of [-5, +5], with a resolution of 101 points in that range; it means that x would be a vector with 101 points. How can I do this?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by