二維曲線、散點(diǎn)圖
繪圖命令:plot(x,y,’line specifiers’,’PropertyName’,PropertyValue)
例子:繪圖表示年收入與年份的關(guān)系
‘--r*’:--設(shè)置線型;r:設(shè)置顏色為紅色;*節(jié)點(diǎn)型號(hào)
‘linewidth’:設(shè)置線寬;‘markersize’:節(jié)點(diǎn)大小
常用命令:hold on(off):在一張圖上持續(xù)繪圖
或者也可使用命令:line()
圖的標(biāo)注
xlabel(‘text’):x軸標(biāo)簽
ylabel(‘text’):y軸標(biāo)簽
title(‘text’):標(biāo)題
text(x,y,‘text’):圖內(nèi)文字
gtext(‘text’):指定位置的文字
legend(‘str1’,‘str2’,…,pos):圖例區(qū)分
其中,pos可取值:
-1:圖例外置于右側(cè)
0:圖例內(nèi)置于最佳位置
1:右上???? 2:左上??? 3:左下?? 4:右下
對數(shù)坐標(biāo)軸
文章來源:http://www.zghlxwxcb.cn/news/detail-811548.html
function epx_plt1
years=1994:2000;
income=[8 12 20 22 18 24 27];
plot(years,income,'--r*','linewidth',2,'markersize',12)
end
?文章來源地址http://www.zghlxwxcb.cn/news/detail-811548.html
x=-2:0.01:4;
y=3*x.^3-26*x+6;
y2=9*x.^2-25;
y3=17*x;
plot(x,y,'-b');
hold on;
plot(x,y2,'--g');
plot(x,y3,'-.r');
hold off;
x=10:0.1:22;
y=95450./x.^2;
x2=10:2:22;
y2=[950 640 460 340 250 180 140];
plot(x,y,'-','linewidth',1)
xlabel('Distance(cm)')
ylabel('Intensity(lux)')
title('','fontsize',14);
axis([8 24 0 1200]);
text(14,700,'Comparison between theory and experiment.','edgecolor','r','linewidth',2);
hold on
plot(x2,y2,'ro--','linewidth',1,'markersize',10);
legend('Theory','Experiment');
hold off;
figure
x=linspace(0.1,60,1000);
y=2.^(-0.2*x+10);
plot(x,y);
figure
semilogx(x,y);
到了這里,關(guān)于數(shù)學(xué)建模實(shí)戰(zhàn)Matlab繪圖的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!