MATLAB简介8

更新时间:2023-05-16 12:09:18 阅读: 评论:0

MATLAB Lecture 8 ­ Graphics ­ Curve
绘图
Ref: MATLAB →Graphics →Basic Plotting Commands
日语学习l  Vocabulary:
plot 绘图 x­axis x 轴
display 显示 annotate 注释
wrapupcurve/curved line 曲线 explicit 显式
implicit 隐式 parameter 参数
polar coordinates 极坐标 boldface 黑体
grid 网格 title 标题
figure 图形 legend 图例
radian 弧度 radius 半径
l  Some functions
plot  ezplot  polar  plot3  title  xlabel  ylabel  *figure  *legend  *subplot
*grid on  *grid off
l  Graphics礼物英语
MA TLAB provides a variety of functions for displaying vector data as line plots, as well as functions for annotating and printing the graphs.
² The reprentation of curve and surface
ü The reprentation of curve on plane
Explicit scheme: y = f(x)
Implicit formula: F(x,y) = 0
Parameter reprentation: ()
()
x x t y y t  = ì í = î Polar coordinates reprentation: ()
f  r q  = Tabulation, say table of trigonometric function, experimental data etc.
Figure, say sine curve, experimental curve etc.
ü The reprentation of curve in space
Explicit scheme: z = f(x,y)
Implicit formula: F(x,y,z) = 0
Parameter reprentation: (,) (,)
(,) x x u v y y u v z z u v  = ì ï = í ï = î
Data form, {},{},{},1,2,...,,1,2,..., i j ij x x y y z z i m j n  ===== .
Graphics
² Basic Plotting Commands
ü Plotting Steps
The process of constructing a basic graph to meet your prentation graphics requirements is outlined in the following table. The table shows ven typical steps and some example code for each.
If you are performing analysis only, you may want to view various graphs just to explore your data. In this ca, steps 1 and 3 may be all you need. If you are creating prentation graphics, you may want to fine­tune your graph by positioning it on the page, tting line styles and colors, adding annotations, and making other such improvements.
Step Typical Code
1. Prepare your data x = 0:0.2:12;
y1 = besl(1,x);
y2 = besl(2,x);
y3 = besl(3,x);
2. Select a window and position a plot region within the window figure(1) subplot(2,2,1)
3. Call elementary plotting function h = plot(x,y1,x,y2,x,y3);
4. Select line and marker characteris­ tics t(h,'LineWidth',2,{'LineStyle'},{'­­';':';'­.'}) t(h,{'Color'},{'r';'g';'b'})
5. Set axis limits, tick marks, and grid lines axis([0 12 ­0.5 1]) grid on
6. Annotate the graph with axis labels, legend, and text xlabel('Time')
ylabel('Amplitude')
legend(h,'First','Second','Third') title('Besl Functions')
[y,ix] = min(y1);
text(x(ix),y,'First Min\rightarrow',... 'HorizontalAlignment','right')
7. Export graph print ­depsc­tiff­r200 myplothdx
ü Plot function
plot(X,Y): plots vector Y versus vector X. If X or Y is a matrix, then the vector is plotted versus the rows or columns of the matrix, whichever line up.
It can be ud to plot of a curve expresd in explicit scheme or parameter reprentation.出国留学条件
>> x = [1 2 3 4 5 6]; y = [1­1.5 2­3 ­1 7];
>> plot(x, y);
>> plot(a); %plot six lines (1, 1); (2, 4); (3, 9); (4, 16); (5, 25); (6, 36)
Plot sin x over [0,2]p with title and grid.
>> t = 0:pi/100:2*pi;
远程教育专升本
>> y = sin(t);
>> plot(t,y)
中医考研科目>> title (‘Plot of sinx vs x’) %titled‘Plot of sinx vs x’
>> xlabel(‘x 轴’); ylabel(‘sinx’) % adds text beside the X­axis & Y­axis …
on the current axis
>> grid on
Plot the curve with sin ,cos  x a mt y a nt  == over [0,2] t  p  Î while a=8, m=2 and n=5.
>> t = linspace(0,2*pi);
% generates a row vector of 100 linearly equally spaced… points between 0 and 2p  . >> a=8;
>> m=2;
>> n=5;
>> x = a*sin(m*t);
>> y = a*cos(n*t);creamer
>> plot (x, y, ‘b­’) % color b lue, line style ‘­’
记录英文ü Polar Plots
polar(THETA, RHO) makes a plot using polar coordinates of the angle THETA, in radians, versus the radius RHO.
>> g=0.5;
>> theta = linspace(0,2*pi,51); %generates 51 linearly equally spaced points…
between 0 and 2p  .
>> gain = 2*g*(1+cos(theta));
>> polar (theta, gain, ‘r­’) %color r ed, line style solid‘­’
>> title (‘\bf Gain versus angle \theta ’); %boldface, \theta will be display as  q
ü Ezplot Function ­­ Easy to u function plotter
It is usually ud to plot a curve expresd in implicit formula.
ezplot(FUN) plots the function FUN(X) over the default domain ­2*pi < X < 2*pi.
ezplot (FUN,[A,B]) plots FUN(X) over A < X < B.
Plot the function 2
21 x x  -+ , over [2,2] x  p p  Î- . >> ezplot('x^2 ­ 2*x + 1');
Plot 444
2 x y  += , over ,[2,2] x y Î- . >> ezplot(‘x.*4+ y.^4­2^4’, [­4,4])
ü Plot3 Function
Plot lines and points in 3­D space.
plot3(x,y,z), where x, y and z are three vectors of the same length, plots a line in 3­space through the points who coordinates are the elements of x, y and z.
plot3 (X,Y ,Z), where X, Y and Z are three matrices of the same size, plots veral lines obtained from the columns of X, Y and Z.
V arious line types, plot symbols and colors may be obtained with plot3 (X,Y ,Z,s) where s is a 1, 2 or 3 character string made from the characters listed under the plot3 command.
>> t = 0:pi/50:10*pi; >> plot3(sin(t),cos(t),t);英语专业网

本文发布于:2023-05-16 12:09:18,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/110601.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:留学   注释   黑体   网格   图形   弧度
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图