-
Notifications
You must be signed in to change notification settings - Fork 3
/
Animated_Chirp2.m
52 lines (42 loc) · 1.13 KB
/
Animated_Chirp2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Fs = 80;
T=2;
t = 0:1/Fs:T ;
f = 400 ;
f1 = [] ;
temp1 = 1 ;
for i = 1 : length(t)
f1 = [f1 temp1] ;
temp1 = temp1 + 0.00005 *f ;
end
y1 = cos( 2* pi * t .* f1 ) ;
% figure
% plot(y1) ;
set(gca,'Color','k') ; % gca for backdround color
set(gca,'xcolor','w','ycolor','w');
xlabel('time'); ylabel('signal');
%xlim([0.01 1]); ylim([-1 1])
an= animatedline;
c = an.Color;
an.Color = 'magenta';
an.LineWidth = 2;
% an.MaximumNumPoints = 1000000;
numpoints = (Fs*T) +1;
for i=1:length(t)
addpoints(an,t(i),y1(i));
drawnow;
set(gcf,'Color','k') % gca for backdround color
F(i) = getframe(gcf);
pause(0.1);
end
% drawnow % draw final frame
video = VideoWriter('Chirp_show_Present.avi', 'Uncompressed AVI');
% video.FrameRate =60;
open(video)
writeVideo(video,F);
close(video)
% ani = animation.FuncAnimation(fig, update, init_func=init, interval=200, frames=22, blit=False)
% ani.save('animation.gif', writer="imagemagick", savefig_kwargs=dict(facecolor='#EAEAF2'))
%sound (y, Fs);
% figure
% plot(t,y1) ;
%