資源描述:
《matlab編程實(shí)例100例》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、1-32是:圖形應(yīng)用篇33-66是:界面設(shè)計(jì)篇67-84是:圖形處理篇85-100是:數(shù)值分析篇實(shí)例1:三角函數(shù)曲線(1)functionshili01h0=figure('toolbar','none',...'position',[19856350300],...'name','實(shí)例01');h1=axes('parent',h0,...'visible','off');x=-pi:0.05:pi;y=sin(x);plot(x,y);xlabel('自變量X');ylabel('函數(shù)值Y');title('SIN()函數(shù)曲線');gridon實(shí)例2:三角函數(shù)曲線(2)fu
2、nctionshili02h0=figure('toolbar','none',...'position',[200150450350],...'name','實(shí)例02');x=-pi:0.05:pi;y=sin(x)+cos(x);plot(x,y,'-*r','linewidth',1);gridonxlabel('自變量X');ylabel('函數(shù)值Y');title('三角函數(shù)');實(shí)例3:圖形的疊加functionshili03h0=figure('toolbar','none',...'position',[200150450350],...'name','實(shí)例03
3、');x=-pi:0.05:pi;y1=sin(x);y2=cos(x);plot(x,y1,...'-*r',...x,y2,...'--og');gridonxlabel('自變量X');ylabel('函數(shù)值Y');title('三角函數(shù)');實(shí)例4:雙y軸圖形的繪制functionshili04h0=figure('toolbar','none',...'position',[200150450250],...'name','實(shí)例04');x=0:900;a=1000;b=0.005;y1=2*x;y2=cos(b*x);[haxes,hline1,hline2]=pl
4、otyy(x,y1,x,y2,'semilogy','plot');axes(haxes(1))ylabel('semilogplot');axes(haxes(2))ylabel('linearplot');實(shí)例5:?jiǎn)蝹€(gè)軸窗口顯示多個(gè)圖形functionshili05h0=figure('toolbar','none',...'position',[200150450250],...'name','實(shí)例05');t=0:pi/10:2*pi;[x,y]=meshgrid(t);subplot(2,2,1)plot(sin(t),cos(t))axisequalsubplot(
5、2,2,2)z=sin(x)-cos(y);plot(t,z)axis([02*pi-22])subplot(2,2,3)h=sin(x)+cos(y);plot(t,h)axis([02*pi-22])subplot(2,2,4)g=(sin(x).^2)-(cos(y).^2);plot(t,g)axis([02*pi-11])實(shí)例6:圖形標(biāo)注functionshili06h0=figure('toolbar','none',...'position',[200150450400],...'name','實(shí)例06');t=0:pi/10:2*pi;h=plot(t,sin(
6、t));xlabel('t=0到2pi','fontsize',16);ylabel('sin(t)','fontsize',16);title('it{從0to2pi的正弦曲線}','fontsize',16)x=get(h,'xdata');y=get(h,'ydata');imin=find(min(y)==y);imax=find(max(y)==y);text(x(imin),y(imin),...['leftarrow最小值=',num2str(y(imin))],...'fontsize',16)text(x(imax),y(imax),...['lef
7、tarrow最大值=',num2str(y(imax))],...'fontsize',16)實(shí)例7:條形圖形functionshili07h0=figure('toolbar','none',...'position',[200150450350],...'name','實(shí)例07');tiao1=[56254822454541445745512];tiao2=[4748575854526548];t=0:7;bar(t,tiao1)xlabel('X軸');ylabel('TIAO1值')