繪圖基礎(chǔ)

Plot from “Data”

? MATLAB does not understand functions
????(??) = sin(2????)
? Strategies

  1. Generate the numeric values of a function over a specific range.
  2. Display the data “points” in a graphical way.

plot()

? plot(x,y) plots each vector pairs (x,y)
? plot(y) plots each vector pairs (x,y),where x=[1…n], n=length(y)
? Example:
??plot(cos(0:pi/20:2*pi));

hold on/off

? Use hold on to have both plots in one figure.

在一張圖片上繪制兩個圖

Plot Style

? plot(x,y,'str') plots each vector pairs (x,y) using the format defined in str (check linespec)

繪圖風(fēng)格

legend()

? Add legend to graph
??legend('L1',...)
? Position adjustment

帶label的函數(shù)圖形

label的實現(xiàn)語法

title() and label()

? title()
? xlabel()
? ylabel()
? zlabel()

屏幕截圖(69).png

x,y軸的名稱及圖片標題

text() and annotation()

? Text with mathematical expression using LaTex


Exercise

? Plot ?? as a black line and ?? as a series of red circles for the range t = 1 to 2 in one figure
???? = ??^2 and ?? = sin(2????)
? Label each axis, and add title and legend

Figure Adjustment

? Several properties:

? Font
? Font size
? Line width
? Axis limit
? Tick position
? Tick label

Graphical Objects

? A figure is composed of many objects

屏幕截圖(81).png

Figure Properties
屏幕截圖(82).png

Modifying Properties of An Object

? Strategy:

  1. Identify the “handle” of an object
  2. Fetch or modify the object’s properties

? For example, to change the limits of the x-axis:

  1. Find the handle of the x-axis
  2. Modify the limits

1. Identifying the Handle of An Object

? Upon creation:
??h = plot(x,y);

? Utility functions:

Fetching or Modifying Properties

? To fetch properties, use
??get( )
? To modify properties, use
??set( )

Getting Object Properties

? Getting properties of a graphical object: get( )

Setting Axes Limits

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,854評論 0 10
  • 喜歡你就是剛注冊的微博,因為想你從2015年到今天這么久,發(fā)的一直都是想你的文字。 喜歡你就是我注冊的QQ小號,隨...
    清清_1b6e閱讀 146評論 0 0
  • 相遇在青春年少的花季雨季,是最美好的邂逅,可是,有時覺得這相遇太美好,因為后來,在眼淚中全明白一旦錯過就不在…… ...
    啊棟閱讀 418評論 0 0
  • 我是對咖啡反應(yīng)比較敏感的人,所以一般傍晚不喝因為怕睡不著,早上或中午必喝因為精神百倍、做事效率高。今天鬼使神差在下...
    麥地水孩子閱讀 573評論 0 2

友情鏈接更多精彩內(nèi)容