[ SVPWM ] MATLAB繪制“箭頭”矢量GIF [ Tutoria...

記得一鍵三連哦?
%% MATLAB GIF繪制教程1
pic_num = 1;%定義幀序列號
fig1 = figure;%創(chuàng)建圖窗fig1
fig1.Units = "centimeters";%圖窗大小單位:cm
fig1.Position = [8 5 20 15];%圖窗顯示位置及大小
fig1.Color = [1 1 1];%圖窗背景白色
for theta = 0:0.1:2*pi
x = cos(theta);
y = sin(theta);
hm = compass(x, y);%圓形網(wǎng)格上繪制箭頭矢量圖
hm.LineWidth = 2;%線寬為2
drawnow;
F = getframe(fig1);%捕獲影片幀
I = frame2im(F);%返回影片幀圖像數(shù)據(jù)
[I, map] = rgb2ind(I, 256);%將RGB轉(zhuǎn)索引圖像
if pic_num == 1
%將圖像寫入文件
imwrite(I, map, 'example1.gif', 'gif', 'LoopCount', inf, 'DelayTime', 0.01);
else
imwrite(I, map, 'example1.gif', 'gif', 'WriteMode', 'append', 'DelayTime', 0.01);
end
pic_num = pic_num + 1;
end
標(biāo)簽: