Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

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

Popular Posts