520快到了,教你用matlab制作动态心形曲线表白(保存为AVI视频版本)

前面用matlab制作了gif的动态心形曲线:matlab制作动态心形曲线(保存为gif版本)

% matlab动态心形曲线(AVI视频版本)
clc;clear all;
a=0;
x=-2:0.01:2;
writerObj = VideoWriter('心形图.avi');
writerObj.FrameRate = 20;
open(writerObj);
figure(1);
set(gcf,'position',[0,0,800,600],'color','w');
for i=1:200
    str_title = strcat('\color{red}a=',num2str(a));
    y = abs(x).^(2/3)+(0.9*sqrt((3.3-x.^2))).*sin(a*pi*x);
    a=i/10;
    figure(i);
    
    set(gcf,'position',[0,0,800,600],'color','w');
    p1 = plot(x,y,'r','LineWidth',3);
    hold on;
    title('\color{red}f(x)=x^2^/^3+e/3*(π-x^2)^1^/^2*sin(a*π*x)','fontsize',15);
    text(-0.2,2.3,str_title,'FontName','Times New Roman','FontSize',20);
    xlim([-2 2]);
    ylim([-1.5 2.5]);
    frame = getframe(gcf);
    writeVideo(writerObj,frame);
    close(figure(i));
    clf;
end
close(writerObj);

效果如下:

[video(video-wGTrViQY-1589545478946)(type-bilibili)(url-https://player.bilibili.com/player.html?aid=200678652)(image-https://ss.csdn.net/p?http://i0.hdslb.com/bfs/archive/6e13ff0e324e1c295c9a71c67a9c1dbd1ec0bbc5.jpg)(title-心形图)]

520快到了,教你用matlab制作动态心形曲线表白(保存为AVI视频版本)_第1张图片

你可能感兴趣的:(Matlab,matlab,视频处理)