matlab练习题和答案 下载本文

内容发布更新时间 : 2024/12/23 10:08:15星期一 下面是文章的全部内容请认真阅读。

f1=y(find(x==-1.5)) f2=y(find(x==0.5)) f3=y(find(x==5))

实验三 Matlab底层图形控制 1 在MATLAB命令行中编程得到y=sin(t)和y1=cos(t)函数, plot(t,y);figure(10);plot(t,y1);

>> t=[-pi:0.05:pi]; >> y=sin(t); >> y1=cos(t); >> plot(t,y) >> figure(10); >> plot(t,y1)

2 在MATLAB命令行中键入h=get(0),查看根屏幕的属性,h此时为根屏幕句柄的符号表示,0为根屏幕对应的标号。

>> h=get(0) h =

BeingDeleted: 'off' BusyAction: 'queue' ButtonDownFcn: '' CallbackObject: [] Children: [2x1 double] Clipping: 'on'

CommandWindowSize: [89 27] CreateFcn: '' CurrentFigure: 1

DeleteFcn: '' Diary: 'off' DiaryFile: 'diary' Echo: 'off'

FixedWidthFontName: 'Courier New' Format: 'short' FormatSpacing: 'loose' HandleVisibility: 'on' HitTest: 'on' Interruptible: 'on' Language: 'zh_cn.gbk'

MonitorPositions: [1 1 1440 900] More: 'off' 6

Parent: []

PointerLocation: [1048 463] PointerWindow: 0 RecursionLimit: 500 ScreenDepth: 32 ScreenPixelsPerInch: 96 ScreenSize: [1 1 1440 900] Selected: 'off'

SelectionHighlight: 'on' ShowHiddenHandles: 'off'

Tag: '' Type: 'root' UIContextMenu: [] Units: 'pixels' UserData: [] Visible: 'on'

3 h1=get(1);h2=get(10), 1, 10分别为两图形窗口对应标号,其中1为Matlab自动分配,标号10已在figure(10)中指定。查看h1和h2属性,注意CurrentAxes和CurrenObject属性。 >> h1=get(1)

h1 =

Alphamap: [1x64 double] BeingDeleted: 'off' BusyAction: 'queue' ButtonDownFcn: '' Children: 170.0012 Clipping: 'on'

CloseRequestFcn: 'closereq' Color: [0.8000 0.8000 0.8000] Colormap: [64x3 double] CreateFcn: '' CurrentAxes: 170.0012 CurrentCharacter: '' CurrentObject: [] CurrentPoint: [0 0]

DeleteFcn: '' DockControls: 'on' FileName: ''

FixedColors: [10x3 double] HandleVisibility: 'on' HitTest: 'on' IntegerHandle: 'on' Interruptible: 'on' InvertHardcopy: 'on' 7

KeyPressFcn: '' KeyReleaseFcn: '' MenuBar: 'figure' MinColormap: 64 Name: '' NextPlot: 'add' NumberTitle: 'on'

PaperOrientation: 'portrait'

PaperPosition: [0.6345 6.3452 20.3046 15.2284] PaperPositionMode: 'manual' PaperSize: [20.9840 29.6774] PaperType: 'A4'

PaperUnits: 'centimeters' Parent: 0