Demonstration of Fourier series of Saw tooth wave in MATLAB

MATLAB Program:


t=0:0.01:2*pi;
w=1;
A=2;
a=2*A/pi;
y=0;
n=input('Enter the n value');
for i=1:n
   y=y+a*((-1)^(i-1))*(1/i)*sin(i*w*t);
i=i+1;
end
plot(t,y);


Output:

Untitled_c
Enter the n value1000






No comments

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();