使用matlab神经网络,Matlab和神经网络--开始--使用Matllab学习Matlab

Matlab和神经网络--开始--使用Matllab学习Matlab

上一章:开始

下一章:

---------------------------------------------------------------------------

寻找Matlab信息最好的地方就是Matlab本身。所有的Matlab函数和Matlab工具箱(包含神经网络工具箱)在帮助文件里都有详细描述。在帮助文档中两个最重要的命令是 help,helpwin 和 lookfor。help在命令窗口中输出帮助文件,helpwin在浏览器中输出同样的信息。lookfor name在返回所有的包含name的命令。如果你在图形界面下,就可以使用‘?’按钮,并浏览帮助文档,这是很好的方法,因为包含了Matlab的概要介绍。

为了演示怎样使用帮助,下面的例子给出怎样使用help命令和阅读结果。这个例子是关于矢量的基本知识,在3.1节你可以得到更多关于矢量和矩阵的知识。

例1

你希望在Matlab中画出y=sinx2在(-10,10)区间内的曲线。你需要做的唯一事情就是使用Matlab本身来帮助你。怎么做呢?

Matlab有非常强大的手册,几乎和程序本身一样。只要输入help和你想要得到帮助的关键字。如果你不知道关键字,就直接输入help。(注意:如果你使用matlab -nodesktop启动Matlab,有可能答案超出屏幕,输入 more 来一次显示一页。如果你想知道关于more的更多请输入help more)

结果是:

HELP topics:

matlab/general       -  General purpose commands.

matlab/ops           -  Operators and special characters.

matlab/lang          -  Programming language constructs.

matlab/elmat         -  Elementary matrices and matrix manipulation.

matlab/elfun         -  Elementary math functions.

matlab/specfun       -  Specialized math functions.

matlab/matfun        -  Matrix functions - numerical linear algebra.

matlab/datafun       -  Data analysis and Fourier transforms.

matlab/audio         -  Audio support.

matlab/polyfun       -  Interpolation and polynomials.

matlab/funfun        -  Function functions and ODE solvers.

matlab/sparfun       -  Sparse matrices.

matlab/graph2d       -  Two dimensional graphs.

matlab/graph3d       -  Three dimensional graphs.

matlab/specgraph     -  Specialized graphs.

matlab/graphics      -  Handle Graphics.

matlab/uitools       -  Graphical user interface tools.

matlab/strfun        -  Character strings.

matlab/iofun         -  File input/output.

matlab/timefun       -  Time and dates.

matlab/datatypes     -  Data types and structures.

matlab/verctrl       -  Version control.

matlab/demos         -  Examples and demonstrations.

toolbox/local        -  Preferences.

nnet/nnet            -  Neural Network Toolbox.

nnet/nnutils         -  (No table of contents file)

nnet/nncontrol       -  Neural Network Toolbox Control System Functions.

nnet/nndemos         -  Neural Network Demonstrations.

nnet/nnobsolete      -  (No table of contents file)

为了得到更多的帮助信息,输入“hlep topic”

因为 你想画二维图形,看起来graph2d最恰当。输入 help matlab/graph2d 或者更短的 help graph2d(你可以用helpwin代替help)!结果是:

Two dimensional graphs.

Elementary X-Y graphs.

plot      - Linear plot.

loglog    - Log-log scale plot.

semilogx  - Semi-log scale plot.

semilogy  - Semi-log scale plot.

polar     - Polar coordinate plot.

plotyy    - Graphs with y tick labels on the left and right.

Axis control.

axis       - Control axis scaling and appearance.

zoom       - Zoom in and out on a 2-D plot.

grid       - Grid lines.

box        - Axis box.

hold       - Hold current graph.

axes       - Create axes in arbitrary positions.

subplot    - Create axes in tiled positions.

Graph annotation.

plotedit  - Tools for editing and annotating plots.

legend    - Graph legend.

title     - Graph title.

xlabel    - X-axis label.

ylabel    - Y-axis label.

texlabel  - Produces TeX format from a character string

text      - Text annotation.

gtext     - Place text with mouse.

Hardcopy and printing.

print      - Print graph or SIMULINK system; or save graph to M-file.

printopt   - Printer defaults.

orient     - Set paper orientation.

See also GRAPH3D, SPECGRAPH.

graph2d即使一个目录也是一个函数。

GRAPH2D建立了GRAPH2D用户的对象包.

因为想画线性图,所以我们继续输入"help plot"

PLOT Linear plot.

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. If X is a scalar and Y is a vector, length(Y)

disconnected points are plotted.

PLOT(Y) plots the columns of Y versus their index.

If Y is complex, PLOT(Y) is equivalent to PLOT(real(Y),imag(Y)).

In all other uses of PLOT, the imaginary part is ignored.

Various line types, plot symbols and colors may be obtained with

PLOT(X,Y,S) where S is a character string made from one element

from any or all the following 3 columns:

y yellow . point - solid

m magenta o circle : dotted

c cyan x x-mark -. dashdot

r red + plus -- dashed

g green * star

b blue s square

w white d diamond

k black v triangle (down)

^ triangle (up)

For example, PLOT(X,Y,'c+:') plots a cyan dotted line with a plus

at each data point; PLOT(X,Y,'bd') plots blue diamond at each data

point but does not draw any line.

PLOT(X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by

the (X,Y,S) triples, where the X's and Y's are vectors or matrices

and the S's are strings.

For example, PLOT(X,Y,'y-',X,Y,'go') plots the data twice, with a

solid yellow line interpolating green circles at the data points.

The PLOT command, if no color is specified, makes automatic use of

the colors specified by the axes ColorOrder property. The default

ColorOrder is listed in the table above for color systems where the

default is yellow for one line, and for multiple lines, to cycle

through the first six colors in the table. For monochrome systems,

PLOT cycles over the axes LineStyleOrder property.

PLOT returns a column vector of handles to LINE objects, one

handle per line.

The X,Y pairs, or X,Y,S triples, can be followed by

parameter/value pairs to specify additional properties

of the lines.

See also SEMILOGX, SEMILOGY, LOGLOG, GRID, CLF, CLC, TITLE, XLABEL,

YLABEL, AXIS, AXES, HOLD, COLORDEF, LEGEND, SUBPLOT, and STEM.

注意Matlab中所有的关键字都是大写字母,例如:PLOT.如果你想使用或查找关键字只能使用小写字母.

在帮助文件的第一行能得到命令的最基本使用方法.这样你可以画出两个矢量X和Y的曲线.也就是画出Y关于X的函数.首先建立两个矢量.

>> x=[-10:0.1:10];

建立一个201个元素的矢量,范围从-10到10,每个元素间隔0.1,也就是

0818b9ca8b590ca3270a3433284dd417.png. 你将在3.1节中学到更多关于矩阵的知识. 当然你也可选择大于或小于0.1的间隔,这会影响到图像的表现 (try it!).

>> y=sin(x.^ 2);

操作x.^ 2 建立一个矢量,这个矢量的每个元素是x 的平方(输入x.^ 2 并检验结果).语句每行以';'结尾不输出结果(见help punct).试试把分号去掉会有什么结果.

现在我们画出已经建立的矢量,照着帮助文件使用 plot 命令.

>> plot(x,y)

我们想画的图将弹出一个新窗口,结果如图 2.1.

Figure:

0818b9ca8b590ca3270a3433284dd417.png in the interval

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

另一个学习Ma t la b 和神经网络工具箱的重要途径是观看演示.观看演示只要输入 demo 再选择一个学习的主题.强烈推荐通过演示来学习Ma t la b 和神经网络工具箱.

Subsections

练习

---------------------------------------------------------------------------------------

上一章:开始

下一章:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值