生活随笔
收集整理的這篇文章主要介紹了
4.7 matlab交互式绘图工具(绘图工具栏)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
直接從matlab工具欄中進行繪圖
直接在命令行窗口輸入figure,則出現(xiàn)空白的圖形窗口
function createfigure(t1
, y1
, yvector1
)
%CREATEFIGURE(t1
, y1
, yvector1
)
% T1
: x 數(shù)據(jù)的向量
% Y1
: y 數(shù)據(jù)的向量
% YVECTOR1
: bar yvector
% 由 MATLAB 于
08-Dec
-2021 16:29:51 自動生成
% 創(chuàng)建 figure
figure1
= figure
;% 創(chuàng)建 subplot
subplot1
= subplot(2,1,1,'Parent',figure1
);
hold(subplot1
,'on');% 創(chuàng)建 plot
plot(t1
,y1
,'ZDataSource','','Parent',subplot1
,'DisplayName','y',...'Color',[0 0.447058826684952 0.74117648601532]);% 創(chuàng)建 ylabel
ylabel('y');% 創(chuàng)建 xlabel
xlabel('x');% 創(chuàng)建 title
title('sin(x)線形圖','Color',[1 0 0]);box(subplot1
,'on');
% 設(shè)置其余坐標(biāo)區(qū)屬性
set(subplot1
,'FontSize',12);
% 創(chuàng)建 legend
legend1
= legend(subplot1
,'show');
set(legend1
,...'Position',[0.773643927418864 0.81660200979407 0.105357142431395 0.0547619034137045]);% 創(chuàng)建 subplot
subplot2
= subplot(2,1,2,'Parent',figure1
);
hold(subplot2
,'on');% 創(chuàng)建 bar
bar(t1
,yvector1
,'DisplayName','z','Parent',subplot2
,...'FaceColor',[0 0.447 0.741]);% 創(chuàng)建 ylabel
ylabel('y');% 創(chuàng)建 xlabel
xlabel('x');% 創(chuàng)建 title
title('cos(x)條形圖','Color',[1 0 0]);box(subplot2
,'on');
% 創(chuàng)建 legend
legend2
= legend(subplot2
,'show');
set(legend2
,...'Position',[0.779253712937596 0.214742128212086 0.101785713966404 0.0476190464837211]);% 創(chuàng)建 arrow
annotation(figure1
,'arrow',[0.634799235181644 0.537284894837476],...[0.832865814696486 0.763578274760383]);% 創(chuàng)建 doublearrow
annotation(figure1
,'doublearrow',[0.422562141491396 0.602294455066922],...[0.363217252396166 0.370607028753994]);
總結(jié)
以上是生活随笔為你收集整理的4.7 matlab交互式绘图工具(绘图工具栏)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。