1 / 9

Lab 2: MATLAB之基本繪圖功能

Lab 2: MATLAB之基本繪圖功能. 二維X-Y座標圖. plot、 plot(x)、plot(x,y)、plot(x,y,’ ‘) loglog、semilogx、semilogy, logspace x=[1:1:5]; y=[1,4,9,16,25]; plot(x,y,’r+’);grid loglog(x,y);grid polar(Θ,ρ) x=0:(pi/18):(2*pi); y=1+cos(x); polar(x,y);. plot相關參數及繪圖視窗應用. whitebg~for MATLAB 4.x graphic window

maude
Télécharger la présentation

Lab 2: MATLAB之基本繪圖功能

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lab 2:MATLAB之基本繪圖功能

  2. 二維X-Y座標圖 • plot、 plot(x)、plot(x,y)、plot(x,y,’ ‘) • loglog、semilogx、semilogy, logspace • x=[1:1:5]; • y=[1,4,9,16,25]; • plot(x,y,’r+’);grid • loglog(x,y);grid • polar(Θ,ρ) • x=0:(pi/18):(2*pi); • y=1+cos(x); • polar(x,y);

  3. plot相關參數及繪圖視窗應用 • whitebg~for MATLAB 4.x • graphic window • 4.2~EditCopy Options • 5.0~FilePreferencesCopying Options • 顏色、形式 • y(黃)、m(洋紅)、c(青)、r(紅) • g(綠)、b(藍)、w(白)、k(黑) • .、o、x、+、* • -(實線)、:(點線)、-.(長點線)、--(虛線)

  4. 標題說明 • title(‘string’) • title(‘This plot is a test!’); • xlabel(‘string’)、ylabel(‘string’) • xlabel(‘time(second)’); • ylabel(‘height(meter)’); • text(x0,y0,’string’)、gtext(‘string’) • text(2,4,‘It is here’); • gtext(‘use your mouse to put the text!’); • grid

  5. 圖形顯示控制 • axis • axis([Xmin Xmax Ymin Ymax])、axis(‘normal‘)、axis(‘square’) • 輪流設定為設定範圍或自動調整 • hold • hold、hold on、hold off • shg、clg • subplot(mnp)

  6. MATLAB程式撰寫入門

  7. .M file 簡介及其他 • 變數名稱=起始值:遞增值:終止值 • 函式 M file • function、macro • %~註解 • 流程控制 • for end • while、if,elself,else • break,pause,return

  8. delt_ang=pi/18; start_ang=0; end_ang=2*pi; offset=2.0; i=0 for ang=start_ang:delt_ang:end_ang, i=i+1; xrad(i)=ang; x(i)=ang*180./pi; y(i)=offset+cos(ang); end plot(x,y); grid; pause; loglog(x,y); grid; pause; polar(xrad,y);

  9. 練習作業 仿照前一頁程式,寫一matlab程式,劃出函數 其中 從 0 度到 360 度

More Related