Matlab 知识点记录
1.Plot 设定与保存格式设置
color_bar5=[0.6,0.3,0.8]*0.93;
figure(1)
plot([1:iteration_time],J_list(1:end),'-','color',color_bar5,'LineWidth',1);
xlabel('Iteration')
ylabel('J Value')
xlim([0,iteration_time]);
ylim([7,10.5]);
title('J Value Plot')
fprintf('The final plots are printed.\n');
fig1 = figure(1);
saveas(fig1,'C:\Users\xxx\Desktop\fig1_J.eps','epsc')
2.Video 视频制作与保存
%Video Start
v=VideoWriter('s_t_3dVideo_dif_test.evi');
open(v);
x=T_list(1:interval:end);
for i=1:n_new_step
y1=S_new_list(1,1:i);
plot(x(1:i),y1,'color',color_bar1,'LineWidth',2);
hold on
title('Agent Position Plot');
xlabel('Time(s)')
ylabel('Position')
xlim([0,x(end)]);
ylim([0,7]);
%get frame
frame = getframe(gcf);
writeVideo(v,frame);
end
close(v);
3.Matlab Color 背景颜色设置