plotting libnez taylor series
Afficher commentaires plus anciens
hi there i have tried to plot libnez's taylor series as a line graph but it will not show up. correctly it only plots the same reslut value for all terms given. I want to plot 20 terms but am have difficultly doing so. Can anyone help me out?
the function is : pi= 4- 4/3+ 4/5- 4/7....
This is what I have so far thanks to Youssef KHMOU ...
value= input('how many values would you like:');
result=zeros(20,1);
signchange= 1;
result(1)=4;
for k= 1:value
term = signchange * 4/(2*k-1);
result(k+1) =result(k)+ term;
signchange = signchange * (-1) ;
end
plot(result)
the only problem is that I want it to plot somehow from terms 0:20
2 commentaires
AngelsaAtWar
le 11 Fév 2013
Youssef Khmou
le 11 Fév 2013
write the index form of the series : per example :
N
-
\ n*(n+1)
/ --------
- (n+3)* n
n=0
Réponse acceptée
Plus de réponses (1)
Youssef Khmou
le 11 Fév 2013
Modifié(e) : Youssef Khmou
le 11 Fév 2013
AngelsaAtWar :
You have to re-post the question with the function you want use and give a general index forumla :
here is you code with 400 iterations :
value=400;
result=zeros(40,1);
signchange= 1;
result(1)=4;
for k = 1:value-1
term = signchange * 4/(2*k-1);
result(k+1) =result(k)+ term;
signchange = signchange * (-1) ;
end
plot(result)
2 commentaires
AngelsaAtWar
le 12 Fév 2013
Youssef Khmou
le 12 Fév 2013
Modifié(e) : Youssef Khmou
le 12 Fév 2013
ok,
what about the last code, is that what you want ( damped sinusoidal function like) ?
if you only want to plot 20, then give 20 as input to value . Or can you give 100000 , but plot only 20 or truncate other elements starting from 21 to end , you have may options,
plot(result(1:20)) % if you gave more than 20 to values or :
result(21:end)=[], plot(result)
Catégories
En savoir plus sur Surface and Mesh Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!