MATLAB Answers

Plotting Infinite series in matlab

145 views (last 30 days)
e(t)=x(t)-xn(t), how can i plot e(t)??

  5 Comments

Show 2 older comments
Rupesh Yadav
Rupesh Yadav on 25 Oct 2020
@Walter Robertson Ya I was asking for the same. Actually we i want to add fourier sine series summation till inf then how to add them and finally plot the same?
Walter Roberson
Walter Roberson on 25 Oct 2020
What is the "same" that you are asking for? Which variables do you want to be fixed in the plot and which do you want want to change? If you have more than one changing variable then which do you want for x, which for y, which for z?
Walter Roberson
Walter Roberson on 25 Oct 2020
Adding an infinite number of terms takes an infinite time, and there is never a "finally" for an infinite time.

Sign in to comment.

Accepted Answer

David Hill
David Hill on 14 Nov 2019
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by