1 / 138

第 5 章 繪圖及模型建構 plotting & model building

第 5 章 繪圖及模型建構 plotting & model building. 圖比表好 表比文字好. xy plotting functions. y=f(x) abscissa ~ x (independent variable) ordinate ~ y (dependent variable) Scale 刻度 tick mark 刻度標示 axis label 軸稱 or axial title data symbol or point marker Legend ~ 說明.

Télécharger la présentation

第 5 章 繪圖及模型建構 plotting & model building

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. 第5章 繪圖及模型建構plotting & model building Puff! The magic dragon, Live by the sea….

  2. 圖比表好 • 表比文字好 Puff! The magic dragon, Live by the sea….

  3. xy plotting functions • y=f(x) • abscissa ~ x (independent variable) • ordinate ~ y (dependent variable) • Scale刻度 • tick mark刻度標示 • axis label 軸稱 or axial title • data symbol or point marker • Legend ~ 說明 Puff! The magic dragon, Live by the sea….

  4. line ~ for theoretical calculation data • data symbol ~ for experimental data Puff! The magic dragon, Live by the sea….

  5. Puff! The magic dragon, Live by the sea….

  6. Requirements of correct plot • P.243-244 • Read it NOW! Puff! The magic dragon, Live by the sea….

  7. Plot, Label & Title commands x=[0:.1:52]; y=.4*sqrt(1.8*x); plot(x,y),xlabel('距離(英里)'),ylabel('距離(英里)'),... title('火箭高度相對於飛行方向的距離函數') grid on, axis([0 52 0 5]) Copy figure Paste it in the word file Puff! The magic dragon, Live by the sea….

  8. Puff! The magic dragon, Live by the sea….

  9. Puff! The magic dragon, Live by the sea….

  10. Plot of complex numbers • plot(y)=plot(real(y),imag(y)) %if y is complex z=.1+.9i; n=[0:0.01:10]; plot(z.^n),xlabel('real part'),ylabel('imaginary part') Puff! The magic dragon, Live by the sea….

  11. Puff! The magic dragon, Live by the sea….

  12. Puff! The magic dragon, Live by the sea….

  13. The function plot command fplot • fplot(‘string’,[xmin xmax]) • fplot(‘string’,[xmin xmax ymin ymax]) f='cos(tan(x))-tan(sin(x))'; fplot(f,[1 2]) Puff! The magic dragon, Live by the sea….

  14. Puff! The magic dragon, Live by the sea….

  15. x=[1:.01:2]; y=cos(tan(x))-tan(sin(x)); plot(x,y) Puff! The magic dragon, Live by the sea….

  16. Puff! The magic dragon, Live by the sea….

  17. Puff! The magic dragon, Live by the sea….

  18. Plotting polynomials • x=[-6:0.01:6]; • p=[3,2,-100,2,-7,90]; • plot(x,polyval(p,x)),xlabel('x'),ylabel('p') Puff! The magic dragon, Live by the sea….

  19. Self testing • pp.250-251 • Write down the program now! Puff! The magic dragon, Live by the sea….

  20. Subplot 子圖 subplot(m,n,p) %將視窗分成m列n行的陣列平面 第p平面 x=[0:.01:5]; y=exp(-1.2*x).*sin(10*x+5); subplot(1,2,1) plot(x,y),xlabel('x1'),ylabel('y1'),axis([0 5 -1 1]) x=[-6:.01:6]; y=abs(x.^3-100); subplot(1,2,2) plot(x,y),xlabel('x2'),ylabel('y2'),axis([-6 6 0 350]) Puff! The magic dragon, Live by the sea….

  21. Puff! The magic dragon, Live by the sea….

  22. overlay plot 層疊圖 • P.253 • A ~ m列*n行 • plot(A) % n條曲線(A的行向量對其索引的圖) • plot(x,A) % A矩陣對x向量作圖 • plot(A,x) % x向量對A矩陣作圖(m條曲線) • plot(A,B) % B矩陣的行對A矩陣的行作圖 Puff! The magic dragon, Live by the sea….

  23. a=[1 2 3;6 5 4;1 5 3] a = 123 6 54 153 ?plot(a) plot(A) % n條曲線(A的行向量對其索引的圖) Puff! The magic dragon, Live by the sea….

  24. x = 10 20 30 40 ?a a = 1 2 3 6 5 4 1 5 3 8 8 8 ?plot(x,a) • plot(x,A) % A矩陣對x向量作圖 Puff! The magic dragon, Live by the sea….

  25. x = 10 20 30 40 ?a a = 1 2 3 6 5 4 1 5 3 8 8 8 ?plot(a,x) plot(A,x) % x向量對A矩陣作圖(m條曲線) Puff! The magic dragon, Live by the sea….

  26. a = 1 2 3 6 5 4 1 5 3 8 8 8 ?b b = 1 2 3 2 4 6 3 6 9 4 8 12 ?plot(a,b) Puff! The magic dragon, Live by the sea….

  27. Data markers and line types Puff! The magic dragon, Live by the sea….

  28. Data markers and line types • plot(x,y,’o’) • plot(x,y,x,y,’o’) Puff! The magic dragon, Live by the sea….

  29. plot(x,y,x,y,’o’) plot(x,y,’o’) Puff! The magic dragon, Live by the sea….

  30. plot(x,y,’ *’,x,y,’:’) Puff! The magic dragon, Live by the sea….

  31. Labeling curves and data x=[0:.01:2]; y=sinh(x); z=tanh(x); plot(x,y,x,z,'--'),xlabel('x'), ... ylabel('Hyperbolic Sine and Tangent'), ... legend('sinh(x)','tanh(x)') Puff! The magic dragon, Live by the sea….

  32. Puff! The magic dragon, Live by the sea….

  33. Legend 的移動 • plot圖出來後 利用滑鼠左鍵移動之 • 格線(grid line)造成legend不明顯 在圖畫好 列印前 加入 axes(legend(‘string1’,‘string2’)) %框與軸線設定一致 refresh %強迫圖形重新繪出 Puff! The magic dragon, Live by the sea….

  34. x=[0:.01:1]; y=tan(x); z=sec(x); plot(x,y,x,z),xlabel('x'), ... ylabel('Tangent and Secant'),gtext('tan(x)'), ... text(.3,1.2,'sec(x)') Puff! The magic dragon, Live by the sea….

  35. Puff! The magic dragon, Live by the sea….

  36. x=[-30:.01:30]; %求解x=tan(x) y=tan(x); z=6*x; plot(x,y,x,z),xlabel('x'), ... ylabel('6x=tan(x) '), axis([-5 5 -100 100]) [x,y]=ginput(5) Puff! The magic dragon, Live by the sea….

  37. Graphical solution of equations圖解法求解方程式 • Example 5.2-1 load line analysis of a circuit Puff! The magic dragon, Live by the sea….

  38. Puff! The magic dragon, Live by the sea….

  39. v_2=[0:.01:20]; i_11=.16*(exp(.12*v_2)-1); i_12=-1/30*v_2+.5; plot(v_2,i_11,v_2,i_12), grid,xlabel('v_2(Volts)'),... ylabel('i_1(Ampere)'),axis([0 20 0 1]),... gtext('load line'),gtext('current') Puff! The magic dragon, Live by the sea….

  40. The answer: i1=0.25 Ampere, v2=7.5V Puff! The magic dragon, Live by the sea….

  41. axis([7 8 .2 .3])% room-in view Puff! The magic dragon, Live by the sea….

  42. The hold command • 2 plot commands p.258-259 x=[-1:.01:1]; y1=3+exp(-x).*sin(6*x); y2=4+exp(-x).*cos(6*x); plot((.1+.9i).^[0:.01:10]),hold,plot(y1,y2),... gtext('y2 VS y1'),gtext('Imag(z) VS Real(z)') gtext最好在都plot完之後再執行,以免亂掉 Puff! The magic dragon, Live by the sea….

  43. Puff! The magic dragon, Live by the sea….

  44. Puff! The magic dragon, Live by the sea….

  45. Puff! The magic dragon, Live by the sea….

  46. Annotating plots 繪圖註解 • Using TEX Puff! The magic dragon, Live by the sea….

  47. Note for improving plots • p.262-263 Puff! The magic dragon, Live by the sea….

  48. Special plot types • Logarithmic plots • Frequency response plots and filter circuits • Controlling tick-mark spacing and labels • Stem, stairs, and bar plots • Separate Y axes • Polar plots Puff! The magic dragon, Live by the sea….

  49. Puff! The magic dragon, Live by the sea….

  50. Logarithmic plots Puff! The magic dragon, Live by the sea….

More Related