Sie sind auf Seite 1von 4

clc; clear; close all;

x = linspace(0,10,20);
y = x.^2;

vobj = VideoWriter('quadratic.avi');
open(vobj)

plot(x,y,'r-'); xlabel('x'); ylabel('y'); grid on; hold on

for i=1:length(x)
moving_marker = plot(x(i),y(i),'ob','MarkerSize',12);
label = num2str(y(i),'%.1f');
marker_label = text(x(i), y(i), label, 'horizontal','left', 'vertical','bottom');
pause(0.1);
writeVideo(vobj,getframe(gcf));
delete(moving_marker); delete(marker_label);
end
close(vobj);

clc; clear; close all;


x = linspace(0,10,20);
y = x.^2;
vobj = VideoWriter('quadratic.avi','Uncompressed AVI');
vobj.Quality = 90; % default 75
open(vobj);
plot(x,y,'r-'); xlabel('x'); ylabel('y'); grid on; hold on
for i=1:length(x)
moving_marker = plot(x(i),y(i),'ob','MarkerSize',12);
label = num2str(y(i),'%.1f');
marker_label = text(x(i), y(i), label, 'horizontal','left',
'vertical','bottom');
pause(0.1);
writeVideo(vobj,getframe(gcf));
delete(moving_marker); delete(marker_label);
end
close(vobj);

clc; clear; close all;


x = linspace(0,10,20);
y = x.^2;
vobj = Videowriter('quadratic.avi');
uncompressedVideo = VideoWriter('quadratic.avi','Uncompressed AVI');
vobj.Framerate = 15; % default 30
vobj.Quality = 90; % default 75
open(vobj)
plot(x,y,'r-'); xlabel('x'); ylabel('y'); grid on; hold on
for i=1:length(x)
moving_marker = plot(x(i),y(i),'ob','MarkerSize',12);
label = num2str(y(i),'%.1f');
marker_label = text(x(i), y(i), label, 'horizontal','left',
'vertical','bottom');
pause(0.1);
writeVideo(vobj,getframe(gcf));
delete(moving_marker); delete(marker_label);
end
close(vobj);

clc; clear; close all;


x = [
0
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.19
0.21
0.23
0.24
0.26
0.28
0.3
0.31
0.32
0.34
0.34
0.35
0.36
0.37
0.39
0.41
0.43
0.45
0.47
0.49
0.5
0.52
0.54
0.55
0.56
0.57
0.58
0.59
0.6
0.61
0.62
0.63
0.65
0.66
0.68
0.7
0.72
0.74
0.76
0.77
0.79
];
y = [
0
0.06
0.21
0.21
0.21
0.3
0.3
0.3
0.45
0.45
0.45
0.69
0.69
0.69
0.87
0.87
0.87
0.87
1.02
1.02
1.02
1.02
1.08
1.08
1.08
1.32
1.32
1.32
1.65
1.65
1.65
2.13
2.13
2.13
2.13
2.58
2.58
2.58
2.58
3.09
3.09
3.09
3.54
3.54
3.54
3.93
3.93
3.93
4.35
];
vobj = VideoWriter('quadratic.avi');
open(vobj)
plot(x,y,'r-'); xlabel('x'); ylabel('y'); grid on; hold on
for i=1:length(x)
moving_marker = plot(x(i),y(i),'ob','MarkerSize',12);
label = num2str(y(i),'%.1f');
marker_label = text(x(i), y(i), label, 'horizontal','left',
'vertical','bottom');
pause(0.1);
writeVideo(vobj,getframe(gcf));
delete(moving_marker); delete(marker_label);
end
close(vobj);

Das könnte Ihnen auch gefallen