MATLAB Answers

0

Plotting Infinite series in matlab

Asked by Kyu Hwan Shim on 14 Nov 2019 at 2:00
Latest activity Answered by David Hill on 14 Nov 2019 at 2:30
e(t)=x(t)-xn(t), how can i plot e(t)??

  0 Comments

Sign in to comment.

1 Answer

Answer by David Hill on 14 Nov 2019 at 2:30
 Accepted Answer

You can plot for various values of t between 0 and 1.
t=.3%not sure what you want to plot against, I held t constant and plotted N vs. error
n=1:2:100000;%have to pick something for infinity (100,000 should be good for about 5 decimal places)
N=1:2:500;%whatever you want N to go up to
x=(4/pi)*sum((1./n).*sin(n*pi*t));
e=arrayfun(@(y)x-(4/pi)*sum((1./(1:2:y)).*sin((1:2:y)*pi*t)),N);
plot(N,e);

  0 Comments

Sign in to comment.