Animation using sine , cosine signal in MATLAB


%Code:

clc
clear all
close all
figure;
axis([-15 15 -5 5]);
pause(2);
t=-5*pi:0.1:5*pi;
x=sin(t)+sin(2*t);
x1=-(sin(t)+sin(2*t));
m=0;
for i=1:length(x)
    a=t(i)+0.5*cos(t);
    b=x(i)+0.5*sin(t);
       fill(a,b,'m');
    axis([-10 10 -5 5]);
    hold on;
    a=t(i)+0.5*cos(t);
    b=x1(i)+0.5*sin(t);
       fill(a,b,'g');
    axis([-15 15 -5 5]);
    hold on;
    pause(0.04);
end


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); })();