SlideShare a Scribd company logo
To get started, select MATLAB Help or Demos from the Help menu.

The element type "name" must be terminated by the matching end-tag "</name>".
Could not parse the file: c:matlab7toolboxccslinkccslinkinfo.xml
>> s=pi*5^2

s=

 78.5398

>> v=s*10

v=

 785.3982

>> qiuhe(9)

ans =

  1.0000

>> qiuhe(9)

ans =

  1.0000

>> qiuhe(9)

ans =

  2.8290

>> qiuhe(-9)

ans =

  -9

>> zs(3)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 5 Column: 10
Missing variable or function.

>> zs(3)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
This statement is incomplete.
>> zs(3)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 5
This statement is incomplete.

>> zs(3)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
This statement is incomplete.

>> zs(3)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 7 Column: 8
This statement is incomplete.

>> zs(3)

ans =

   1

>> zs(19)

ans =

   1

>> zs(1:19)
>> zs(1:19)
>> zs(3,19)
??? Error using ==> zs
Too many input arguments.

>> isprime(3)

ans =

   1

>> help prime

prime.m not found.

Use the Help browser Search tab to search the documentation, or
type "help help" for help command options, such as help for methods.

>> prime(3:19)
??? Undefined command/function 'prime'.

>> mod(1:9,3)
ans =

   1    2    0    1   2   0   1   2    0

>> zs(3:9)

ans =

   1

>> zs(4:9)

ans =

   1

>> zs(4:9)

ans =

   1

>> help mod
MOD Modulus after division.
  MOD(x,y) is x - n.*y where n = floor(x./y) if y ~= 0. If y is not an
  integer and the quotient x./y is within roundoff error of an integer,
  then n is that integer. By convention, MOD(x,0) is x. The input
  x and y must be real arrays of the same size, or real scalars.

  The statement "x and y are congruent mod m" means mod(x,m) == mod(y,m).

  MOD(x,y) has the same sign as y while REM(x,y) has the same sign as x.
  MOD(x,y) and REM(x,y) are equal if x and y have the same sign, but
  differ by y if x and y have different signs.

  See also rem.

  Overloaded functions or methods (ones with the same name in other directories)
   help sym/mod.m

  Reference page in Help browser
   doc mod



>> zs(8)

ans =
0

>> zs(8)

ans =

  0

>> zs(8)

ans =

  0

>> zs(8)

ans =

  0

>> zs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.

>> zs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.

>> zs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.

>> zs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.

>> showzs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.

Error in ==> showzs at 5
  if zs(i)

>> showzs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.
Error in ==> showzs at 5
  if zs(i)

>> zs(8)

ans =

  0

>> zs(8)

ans =

  0

>> showzs(8)

ans =

  2     3    5    7

>> showzs(100)

ans =

 Columns 1 through 14

  2     3    5    7   11   13   17   19   23   29   31   37   41   43

 Columns 15 through 25

  47    53   59    61   67   71   73   79   83   89   97

>> y=[1;2;3]

y=

  1
  2
  3

>> y=[y;9]

y=

  1
  2
  3
  9
>> A=[1 2; 3 4]

A=

  1    2
  3    4

>> A=[A;[5 6]]

A=

  1    2
  3    4
  5    6

>> A=[A [7;8;9]]

A=

  1    2   7
  3    4   8
  5    6   9



>> A

A=

  1    2   7
  3    4   8
  5    6   9

>> A=[1 2; 3 4]

A=

  1    2
  3    4

>> A=[A [7;8];[5 6 9]]

A=

  1    2   7
  3    4   8
  5    6   9
>> %-- 09-2-19 上午 10:58 --%
>> A=[2 5;9 7]

A=

     2   5
     9   7

>> B=[9 6;3 1]

B=

     9   6
     3   1

>> A*B

ans =

  33 17
 102 61

>> I=[1 0;0 1]

I=

     1   0
     0   1

>> A*I

ans =

     2   5
     9   7

>> B*I

ans =

  9      6
   3      1

>> C=A^(-1)

C=

 -0.2258 0.1613
  0.2903 -0.0645
>> A*C

ans =

  1.0000       0
  0.0000    1.0000

>> % C 为 A 的逆矩阵
>> D=[2 3;4 6]

D=

   2    3
   4    6

>> D^(-1)
Warning: Matrix is singular to working precision.

ans =

 Inf Inf
 Inf Inf

>> B^(-1)

ans =

 -0.1111 0.6667
  0.3333 -1.0000

>> A = [2 3 -1; 1 -12 8; 6 5 -11];
>> b = [6;12;1];
>> x = A^(-1)*b

x=

  3.1690
  0.5106
  1.8697

>> A

A=

   2 3 -1
   1 -12 8
   6 5 -11
>> A(2,5)=0

A=

  2 3 -1         0    0
  1 -12 8         0    0
  6 5 -11         0    0

>> size(A)

ans =

  3     5

>> X=1:6

X=

  1     2    3   4    5    6

>> X(:)

ans =

  1
  2
  3
  4
  5
  6

>> help sort
SORT Sort in ascending or descending order.
  For vectors, SORT(X) sorts the elements of X in ascending order.
  For matrices, SORT(X) sorts each column of X in ascending order.
  For N-D arrays, SORT(X) sorts the along the first non-singleton
  dimension of X. When X is a cell array of strings, SORT(X) sorts
  the strings in ASCII dictionary order.

  Y = SORT(X,DIM,MODE)
  has two optional parameters.
  DIM selects a dimension along which to sort.
  MODE selects the direction of the sort
    'ascend' results in ascending order
    'descend' results in descending order
  The result is in Y which has the same shape and type as X.

  [Y,I] = SORT(X,DIM,MODE) also returns an index matrix I.
  If X is a vector, then Y = X(I).
If X is an m-by-n matrix and DIM=1, then
     for j = 1:n, Y(:,j) = X(I(:,j),j); end

  When X is complex, the elements are sorted by ABS(X). Complex
  matches are further sorted by ANGLE(X).

  When more than one element has the same value, the order of the
  elements are preserved in the sorted result and the indexes of
  equal elements will be ascending in any index matrix.

  Example: If X = [3 7 5
            0 4 2]

  then sort(X,1) is [0 4 2 and sort(X,2) is [3 5 7
              3 7 5]            0 2 4];

  See also issorted, sortrows, min, max, mean, median.

  Overloaded functions or methods (ones with the same name in other directories)
   help cell/sort.m
   help sym/sort.m
   help xregdesign/sort.m
   help sweepset/sort.m

  Reference page in Help browser
   doc sort

 To get started, select MATLAB Help or Demos from the Help menu.

The element type "name" must be terminated by the matching end-tag "</name>".
Could not parse the file: c:matlab7toolboxccslinkccslinkinfo.xml
>> A=[2 5 1;3.5 9 8;-2 3 6]

A=

  2.0000 5.0000 1.0000
  3.5000 9.0000 8.0000
 -2.0000 3.0000 6.0000

>> format short
>> A

A=

  2.0000 5.0000 1.0000
  3.5000 9.0000 8.0000
 -2.0000 3.0000 6.0000

>> x=9;
>> y=pi/6;
>> A=[2,5,cos(y);sin(y),x^2,8;x/2 3 6]

A=

  2.0000 5.0000 0.8660
  0.5000 81.0000 8.0000
  4.5000 3.0000 6.0000

>> A(3 3)=0
??? A(3 3)=0
     |
Error: Missing MATLAB operator.

>> A(3,3)=0

A=

  2.0000 5.0000 0.8660
  0.5000 81.0000 8.0000
  4.5000 3.0000     0

>> help sort
SORT Sort in ascending or descending order.
  For vectors, SORT(X) sorts the elements of X in ascending order.
  For matrices, SORT(X) sorts each column of X in ascending order.
  For N-D arrays, SORT(X) sorts the along the first non-singleton
  dimension of X. When X is a cell array of strings, SORT(X) sorts
  the strings in ASCII dictionary order.

  Y = SORT(X,DIM,MODE)
  has two optional parameters.
  DIM selects a dimension along which to sort.
  MODE selects the direction of the sort
    'ascend' results in ascending order
    'descend' results in descending order
  The result is in Y which has the same shape and type as X.

  [Y,I] = SORT(X,DIM,MODE) also returns an index matrix I.
  If X is a vector, then Y = X(I).
  If X is an m-by-n matrix and DIM=1, then
     for j = 1:n, Y(:,j) = X(I(:,j),j); end

  When X is complex, the elements are sorted by ABS(X). Complex
  matches are further sorted by ANGLE(X).

  When more than one element has the same value, the order of the
  elements are preserved in the sorted result and the indexes of
  equal elements will be ascending in any index matrix.
Example: If X = [3 7 5
            0 4 2]

  then sort(X,1) is [0 4 2 and sort(X,2) is [3 5 7
              3 7 5]            0 2 4];

  See also issorted, sortrows, min, max, mean, median.

  Overloaded functions or methods (ones with the same name in other directories)
   help cell/sort.m
   help sym/sort.m
   help xregdesign/sort.m
   help sweepset/sort.m

  Reference page in Help browser
   doc sort



>> A(2,5)=1

A=

  2.0000 5.0000 0.8660              0       0
  0.5000 81.0000 8.0000              0   1.0000
  4.5000 3.0000     0           0        0

>> A(1)

ans =

   2

>> A(0)
??? Subscript indices must either be real positive integers or logicals.

>> size(A)

ans =

   3    5

>> length(A)

ans =

   5
>> x=1:6

x=

     1    2   3    4   5   6

>> y=reshape(x,2,3)

y=

     1    3   5
     2    4   6

>> y(:)

ans =

     1
     2
     3
     4
     5
     6

>> R=[1 5 8;3 9 -6]

R=

     1    5    8
     3    9   -6

>> S=[3.2 5 6;-1 0 3];
>> F=R+S*i

F=

 1.0000 + 3.2000i 5.0000 + 5.0000i 8.0000 + 6.0000i
 3.0000 - 1.0000i 9.0000       -6.0000 + 3.0000i

>> t=0:3:10

t=

     0    3   6    9

>> s=0:5:-18

s=
Empty matrix: 1-by-0

>> s=0:-5:-18

s=

     0   -5 -10 -15

>> t=0:5

t=

     0   1   2   3    4   5

>>>> A=[1 4 7 10;2 5 8 11;3 6 9 12]

A=

     1   4   7   10
     2   5   8   11
     3   6   9   12

>> B=[13 23 5 4 12;16 -24 -21 -18 10;14 0 28 -43 33;25 -3 -16 -1 11;13 -32 10 -20 -12]

B=

  13 23 5          4 12
  16 -24 -21      -18 10
  14 0 28        -43 33
  25 -3 -16       -1 11
  13 -32 10       -20 -12

>> A(8,3)=5

A=

     1   4   7   10
     2   5   8   11
     3   6   9   12
     0   0   0    0
     0   0   0    0
     0   0   0    0
     0   0   0    0
     0   0   5    0

>> B=[13 23 5 4 12;16 -24 -21 -18 10;14 0 28 -43 33;25 -3 -16 -1 11;13 -32 10 -20 -12]

B=
13 23 5         4 12
  16 -24 -21     -18 10
  14 0 28       -43 33
  25 -3 -16      -1 11
  13 -32 10      -20 -12

>> A=[1 4 7 10;2 5 8 11;3 6 9 12]

A=

   1   4   7   10
   2   5   8   11
   3   6   9   12

>> A(3,8)=5

A=

   1   4   7   10     0   0   0     0
   2   5   8   11     0   0   0     0
   3   6   9   12     0   0   0     5

>> x=1:8

x=

   1   2   3    4   5     6   7   8

>> A=(x,2,4)
??? A=(x,2,4)
     |
Error: Incomplete or misformed expression or statement.

>> A=reshape(x,2,4)

A=

   1   3   5    7
   2   4   6    8

>> x=1:8

x=

   1   2   3    4   5     6   7   8

>> A=(1 2 3 4;5 6 7 8)
??? A=(1 2 3 4;5 6 7 8)
     |
Error: Missing MATLAB operator.

>> A=[1 2 3 4;5 6 7 8]

A=

   1    2    3   4
   5    6    7   8

>> size(A)

ans =

   2    4

>> A(6)

ans =

   7

>> A=[1 2 3 4;5 6 7 8]

A=

   1    2    3   4
   5    6    7   8

>> A(6)

ans =

   7

>> x=[1,2,3]

x=

   1    2    3

>> y=[1;2;3]

y=

   1
   2
   3

>> size(x)
ans =

   1    3

>> size(y)

ans =

   3    1

>> length(x)

ans =

   3

>> length(y)

ans =

   3

>> x=1:30

x=

 Columns 1 through 11

   1    2    3     4     5     6     7    8   9    10   11

 Columns 12 through 22

  12    13    14    15       16    17    18   19   20   21   22

 Columns 23 through 30

  23    24    25    26       27    28    29   30

>> x=1:30;
>> A=reshape(x,5,6)

A=

   1     6   11    16    21       26
   2     7   12    17    22       27
   3     8   13    18    23       28
   4     9   14    19    24       29
   5    10    15    20    25       30
>> R=[1 2 3 4 5 6]

R=

  1     2   3   4    5   6

>> S=[1 2 3 4 5 6];
>> A=R+s*i
??? Error using ==> plus
Matrix dimensions must agree.

>> S

S=

  1     2   3   4    5   6

>> A=R+S*i

A=

 Columns 1 through 4

 1.0000 + 1.0000i 2.0000 + 2.0000i 3.0000 + 3.0000i 4.0000 + 4.0000i

 Columns 5 through 6

 5.0000 + 5.0000i 6.0000 + 6.0000i

>> A'

ans =

 1.0000 - 1.0000i
 2.0000 - 2.0000i
 3.0000 - 3.0000i
 4.0000 - 4.0000i
 5.0000 - 5.0000i
 6.0000 - 6.0000i

>> A'*A

ans =

  2      4 6 8 10 12
  4      8 12 16 20 24
  6     12 18 24 30 36
  8     16 24 32 40 48
10    20    30    40       50    60
  12    24    36    48       60    72

>> x=1:2:20

x=

  1     3    5     7     9    11    13     15    17   19

>> length(x)

ans =

  10

>> x=0.2:0.3:3.5

x=

 Columns 1 through 7

  0.2000     0.5000      0.8000         1.1000   1.4000    1.7000   2.0000

 Columns 8 through 12

  2.3000     2.6000      2.9000         3.2000   3.5000

>> y=sin(x)

y=

 Columns 1 through 7

  0.1987     0.4794      0.7174         0.8912   0.9854    0.9917   0.9093

 Columns 8 through 12

  0.7457     0.5155      0.2392 -0.0584 -0.3508

>> max(y)

ans =

  0.9917

>> length(y)

ans =
12

>> sum(y)/length(y)

ans =

  0.5220

>> help mean
MEAN Average or mean value.
  For vectors, MEAN(X) is the mean value of the elements in X. For
  matrices, MEAN(X) is a row vector containing the mean value of
  each column. For N-D arrays, MEAN(X) is the mean value of the
  elements along the first non-singleton dimension of X.

  MEAN(X,DIM) takes the mean along the dimension DIM of X.

  Example: If X = [0 1 2
            3 4 5]

  then mean(X,1) is [1.5 2.5 3.5] and mean(X,2) is [1
                                  4]

  Class support for input X:
   float: double, single

  See also median, std, min, max, cov.

  Overloaded functions or methods (ones with the same name in other directories)
   help fints/mean.m
   help sweepset/mean.m

  Reference page in Help browser
   doc mean



>> mean(y)

ans =

  0.5220

>> help max
MAX Largest component.
  For vectors, MAX(X) is the largest element in X. For matrices,
  MAX(X) is a row vector containing the maximum element from each
  column. For N-D arrays, MAX(X) operates along the first
  non-singleton dimension.
[Y,I] = MAX(X) returns the indices of the maximum values in vector I.
  If the values along the first non-singleton dimension contain more
  than one maximal element, the index of the first one is returned.

  MAX(X,Y) returns an array the same size as X and Y with the
  largest elements taken from X or Y. Either one can be a scalar.

  [Y,I] = MAX(X,[],DIM) operates along the dimension DIM.

  When complex, the magnitude MAX(ABS(X)) is used, and the angle
  ANGLE(X) is ignored. NaN's are ignored when computing the maximum.

  Example: If X = [2 8 4 then max(X,[],1) is [7 8 9],
            7 3 9]

     max(X,[],2) is [8   and max(X,5) is [5 8 5
              9],            7 5 9].

  See also min, median, mean, sort.

  Overloaded functions or methods (ones with the same name in other directories)
   help quantizer/max.m
   help fints/max.m
   help localpspline/max.m
   help localpoly/max.m

  Reference page in Help browser
   doc max



>> [Y,y] = MAX(X)
??? Undefined function or variable 'X'.

>> man(Y,y)
??? Undefined function or variable 'Y'.

>> man(y)
??? Undefined command/function 'man'.

>> max(y)

ans =

  0.9917

>> find(y==max(y))
ans =

   6

>> x=rand(5,1)

x=

  0.9501
  0.2311
  0.6068
  0.4860
  0.8913

>> sort(x)

ans =

  0.2311
  0.4860
  0.6068
  0.8913
  0.9501

>> help sort
SORT Sort in ascending or descending order.
  For vectors, SORT(X) sorts the elements of X in ascending order.
  For matrices, SORT(X) sorts each column of X in ascending order.
  For N-D arrays, SORT(X) sorts the along the first non-singleton
  dimension of X. When X is a cell array of strings, SORT(X) sorts
  the strings in ASCII dictionary order.

  Y = SORT(X,DIM,MODE)
  has two optional parameters.
  DIM selects a dimension along which to sort.
  MODE selects the direction of the sort
    'ascend' results in ascending order
    'descend' results in descending order
  The result is in Y which has the same shape and type as X.

  [Y,I] = SORT(X,DIM,MODE) also returns an index matrix I.
  If X is a vector, then Y = X(I).
  If X is an m-by-n matrix and DIM=1, then
     for j = 1:n, Y(:,j) = X(I(:,j),j); end

  When X is complex, the elements are sorted by ABS(X). Complex
  matches are further sorted by ANGLE(X).

  When more than one element has the same value, the order of the
elements are preserved in the sorted result and the indexes of
  equal elements will be ascending in any index matrix.

  Example: If X = [3 7 5
            0 4 2]

  then sort(X,1) is [0 4 2 and sort(X,2) is [3 5 7
              3 7 5]            0 2 4];

  See also issorted, sortrows, min, max, mean, median.

  Overloaded functions or methods (ones with the same name in other directories)
   help cell/sort.m
   help sym/sort.m
   help xregdesign/sort.m
   help sweepset/sort.m

  Reference page in Help browser
   doc sort



>> sort(x,ascend)
??? Undefined function or variable 'ascend'.

>> sort(x,ascending)
??? Undefined function or variable 'ascending'.

>> sort(x,'ascending')
??? Error using ==> sort
sorting direction must be 'ascend' or 'descend'.

>> sort(x,descend)
??? Undefined function or variable 'descend'.

>> -sort(-x)

ans =

  0.9501
  0.8913
  0.6068
  0.4860
  0.2311

>> -x

ans =
-0.9501
 -0.2311
 -0.6068
 -0.4860
 -0.8913

>> a=-x

a=

 -0.9501
 -0.2311
 -0.6068
 -0.4860
 -0.8913

>> sort(a)

ans =

 -0.9501
 -0.8913
 -0.6068
 -0.4860
 -0.2311

>> -sort(-x)

ans =

  0.9501
  0.8913
  0.6068
  0.4860
  0.2311

>> sort(-x)

ans =

 -0.9501
 -0.8913
 -0.6068
 -0.4860
 -0.2311

>> -sort(-a)

ans =
-0.2311
 -0.4860
 -0.6068
 -0.8913
 -0.9501

>>

More Related Content

PDF
PPS
PPT
Presentacion calculo1
PPT
7 3elimination
PPTX
MATLAB - Arrays and Matrices
PPTX
Presentacion calculo jan
PPTX
MATLAB - Aplication of Arrays and Matrices in Electrical Systems
PDF
S1 3 derivadas_resueltas
Presentacion calculo1
7 3elimination
MATLAB - Arrays and Matrices
Presentacion calculo jan
MATLAB - Aplication of Arrays and Matrices in Electrical Systems
S1 3 derivadas_resueltas

What's hot (19)

PPTX
Graph a function
PDF
Module 1 quadratic functions
PPTX
PDF
Funcion lineal y cuadratica
PPTX
List and Dictionary in python
PDF
Module 1 linear functions
PDF
Module 3 quadratic functions
PPTX
11 graphs of first degree functions x
PPTX
S1 3 derivadas_resueltas
PPT
Factorising Quadratics
PPTX
Matlab ch1 (3)
PPTX
Minimization model by simplex method
PPTX
8 inequalities and sign charts x
PPTX
1.6 sign charts and inequalities t
PPTX
7 sign charts of factorable formulas y
PPTX
February 11 2016
PDF
Introduction to Functions
DOCX
AS LEVEL QUADRATIC (CIE) EXPLAINED WITH EXAMPLE AND DIAGRAMS
PPTX
1.2 algebraic expressions
Graph a function
Module 1 quadratic functions
Funcion lineal y cuadratica
List and Dictionary in python
Module 1 linear functions
Module 3 quadratic functions
11 graphs of first degree functions x
S1 3 derivadas_resueltas
Factorising Quadratics
Matlab ch1 (3)
Minimization model by simplex method
8 inequalities and sign charts x
1.6 sign charts and inequalities t
7 sign charts of factorable formulas y
February 11 2016
Introduction to Functions
AS LEVEL QUADRATIC (CIE) EXPLAINED WITH EXAMPLE AND DIAGRAMS
1.2 algebraic expressions
Ad

Viewers also liked (7)

DOC
1.A Question of Rights
PDF
2009级 截止至2011年1月成绩汇总表
PDF
Digital booklet sparks fly deluxe
PDF
《电子技术基础(模拟部分)》康华光第五版...(1)
PDF
从研究生角度,回望大学四年数学建模路【原创】
DOC
Google和各种网站的IPv6服务hosts列表
PDF
从研究生角度,回望大学四年数学建模路【原创】
1.A Question of Rights
2009级 截止至2011年1月成绩汇总表
Digital booklet sparks fly deluxe
《电子技术基础(模拟部分)》康华光第五版...(1)
从研究生角度,回望大学四年数学建模路【原创】
Google和各种网站的IPv6服务hosts列表
从研究生角度,回望大学四年数学建模路【原创】
Ad

Similar to 20100528 (20)

PPTX
An Introduction to MATLAB for beginners
PPTX
MATLAB ARRAYS
PPTX
Introduction to Matlab and application.pptx
PDF
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
PDF
Matlabch01
PDF
Matlab quick quide3.4
PDF
Matlab practice
PPT
Matlab Overviiew 2
PDF
Introduction to matlab chapter2 by Dr.Bashir m. sa'ad.pdf
PDF
PDF
Matlab
PPTX
presentation.pptx
PPTX
Matlab-1.pptx
PDF
matlab functions
PDF
PDF
Matlab booklet
PPT
matlab_tutorial.ppt
PPT
matlab_tutorial.ppt
PPT
matlab_tutorial.ppt
PPT
Introduction to Matlab - Basic Functions
An Introduction to MATLAB for beginners
MATLAB ARRAYS
Introduction to Matlab and application.pptx
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
Matlabch01
Matlab quick quide3.4
Matlab practice
Matlab Overviiew 2
Introduction to matlab chapter2 by Dr.Bashir m. sa'ad.pdf
Matlab
presentation.pptx
Matlab-1.pptx
matlab functions
Matlab booklet
matlab_tutorial.ppt
matlab_tutorial.ppt
matlab_tutorial.ppt
Introduction to Matlab - Basic Functions

More from byron zhao (20)

PDF
网页设计语言教程Html css
PDF
电路作业
PDF
Multisim8
PDF
回转器的原理与应用
DOC
新概念第四册课文打印版
DOC
实验报告4:使用SQL语句进行SQL Server 2000数据库操作
DOC
未命名 1.odt
PDF
027501-01
PDF
小波变换程序
PDF
未命名 24
DOC
小波变换程序.odt
DOC
刚体
DOC
健康上网专家密码
DOC
大物实验报告(太阳能电池).odt
PDF
电路作业
DOC
就业是大学生校园生活质量的试金石.odt
PDF
Multisim8
DOC
新建 Open Office 文本 (2).odt
PDF
回转器的原理与应用
DOC
新概念第四册课文打印版
网页设计语言教程Html css
电路作业
Multisim8
回转器的原理与应用
新概念第四册课文打印版
实验报告4:使用SQL语句进行SQL Server 2000数据库操作
未命名 1.odt
027501-01
小波变换程序
未命名 24
小波变换程序.odt
刚体
健康上网专家密码
大物实验报告(太阳能电池).odt
电路作业
就业是大学生校园生活质量的试金石.odt
Multisim8
新建 Open Office 文本 (2).odt
回转器的原理与应用
新概念第四册课文打印版

20100528

  • 1. To get started, select MATLAB Help or Demos from the Help menu. The element type "name" must be terminated by the matching end-tag "</name>". Could not parse the file: c:matlab7toolboxccslinkccslinkinfo.xml >> s=pi*5^2 s= 78.5398 >> v=s*10 v= 785.3982 >> qiuhe(9) ans = 1.0000 >> qiuhe(9) ans = 1.0000 >> qiuhe(9) ans = 2.8290 >> qiuhe(-9) ans = -9 >> zs(3) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 5 Column: 10 Missing variable or function. >> zs(3) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8 This statement is incomplete.
  • 2. >> zs(3) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 5 This statement is incomplete. >> zs(3) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8 This statement is incomplete. >> zs(3) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 7 Column: 8 This statement is incomplete. >> zs(3) ans = 1 >> zs(19) ans = 1 >> zs(1:19) >> zs(1:19) >> zs(3,19) ??? Error using ==> zs Too many input arguments. >> isprime(3) ans = 1 >> help prime prime.m not found. Use the Help browser Search tab to search the documentation, or type "help help" for help command options, such as help for methods. >> prime(3:19) ??? Undefined command/function 'prime'. >> mod(1:9,3)
  • 3. ans = 1 2 0 1 2 0 1 2 0 >> zs(3:9) ans = 1 >> zs(4:9) ans = 1 >> zs(4:9) ans = 1 >> help mod MOD Modulus after division. MOD(x,y) is x - n.*y where n = floor(x./y) if y ~= 0. If y is not an integer and the quotient x./y is within roundoff error of an integer, then n is that integer. By convention, MOD(x,0) is x. The input x and y must be real arrays of the same size, or real scalars. The statement "x and y are congruent mod m" means mod(x,m) == mod(y,m). MOD(x,y) has the same sign as y while REM(x,y) has the same sign as x. MOD(x,y) and REM(x,y) are equal if x and y have the same sign, but differ by y if x and y have different signs. See also rem. Overloaded functions or methods (ones with the same name in other directories) help sym/mod.m Reference page in Help browser doc mod >> zs(8) ans =
  • 4. 0 >> zs(8) ans = 0 >> zs(8) ans = 0 >> zs(8) ans = 0 >> zs(8) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8 The expression to the left of the equals sign is not a valid target for an assignment. >> zs(8) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8 The expression to the left of the equals sign is not a valid target for an assignment. >> zs(8) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8 The expression to the left of the equals sign is not a valid target for an assignment. >> zs(8) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8 The expression to the left of the equals sign is not a valid target for an assignment. >> showzs(8) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8 The expression to the left of the equals sign is not a valid target for an assignment. Error in ==> showzs at 5 if zs(i) >> showzs(8) ??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8 The expression to the left of the equals sign is not a valid target for an assignment.
  • 5. Error in ==> showzs at 5 if zs(i) >> zs(8) ans = 0 >> zs(8) ans = 0 >> showzs(8) ans = 2 3 5 7 >> showzs(100) ans = Columns 1 through 14 2 3 5 7 11 13 17 19 23 29 31 37 41 43 Columns 15 through 25 47 53 59 61 67 71 73 79 83 89 97 >> y=[1;2;3] y= 1 2 3 >> y=[y;9] y= 1 2 3 9
  • 6. >> A=[1 2; 3 4] A= 1 2 3 4 >> A=[A;[5 6]] A= 1 2 3 4 5 6 >> A=[A [7;8;9]] A= 1 2 7 3 4 8 5 6 9 >> A A= 1 2 7 3 4 8 5 6 9 >> A=[1 2; 3 4] A= 1 2 3 4 >> A=[A [7;8];[5 6 9]] A= 1 2 7 3 4 8 5 6 9
  • 7. >> %-- 09-2-19 上午 10:58 --% >> A=[2 5;9 7] A= 2 5 9 7 >> B=[9 6;3 1] B= 9 6 3 1 >> A*B ans = 33 17 102 61 >> I=[1 0;0 1] I= 1 0 0 1 >> A*I ans = 2 5 9 7 >> B*I ans = 9 6 3 1 >> C=A^(-1) C= -0.2258 0.1613 0.2903 -0.0645
  • 8. >> A*C ans = 1.0000 0 0.0000 1.0000 >> % C 为 A 的逆矩阵 >> D=[2 3;4 6] D= 2 3 4 6 >> D^(-1) Warning: Matrix is singular to working precision. ans = Inf Inf Inf Inf >> B^(-1) ans = -0.1111 0.6667 0.3333 -1.0000 >> A = [2 3 -1; 1 -12 8; 6 5 -11]; >> b = [6;12;1]; >> x = A^(-1)*b x= 3.1690 0.5106 1.8697 >> A A= 2 3 -1 1 -12 8 6 5 -11
  • 9. >> A(2,5)=0 A= 2 3 -1 0 0 1 -12 8 0 0 6 5 -11 0 0 >> size(A) ans = 3 5 >> X=1:6 X= 1 2 3 4 5 6 >> X(:) ans = 1 2 3 4 5 6 >> help sort SORT Sort in ascending or descending order. For vectors, SORT(X) sorts the elements of X in ascending order. For matrices, SORT(X) sorts each column of X in ascending order. For N-D arrays, SORT(X) sorts the along the first non-singleton dimension of X. When X is a cell array of strings, SORT(X) sorts the strings in ASCII dictionary order. Y = SORT(X,DIM,MODE) has two optional parameters. DIM selects a dimension along which to sort. MODE selects the direction of the sort 'ascend' results in ascending order 'descend' results in descending order The result is in Y which has the same shape and type as X. [Y,I] = SORT(X,DIM,MODE) also returns an index matrix I. If X is a vector, then Y = X(I).
  • 10. If X is an m-by-n matrix and DIM=1, then for j = 1:n, Y(:,j) = X(I(:,j),j); end When X is complex, the elements are sorted by ABS(X). Complex matches are further sorted by ANGLE(X). When more than one element has the same value, the order of the elements are preserved in the sorted result and the indexes of equal elements will be ascending in any index matrix. Example: If X = [3 7 5 0 4 2] then sort(X,1) is [0 4 2 and sort(X,2) is [3 5 7 3 7 5] 0 2 4]; See also issorted, sortrows, min, max, mean, median. Overloaded functions or methods (ones with the same name in other directories) help cell/sort.m help sym/sort.m help xregdesign/sort.m help sweepset/sort.m Reference page in Help browser doc sort To get started, select MATLAB Help or Demos from the Help menu. The element type "name" must be terminated by the matching end-tag "</name>". Could not parse the file: c:matlab7toolboxccslinkccslinkinfo.xml >> A=[2 5 1;3.5 9 8;-2 3 6] A= 2.0000 5.0000 1.0000 3.5000 9.0000 8.0000 -2.0000 3.0000 6.0000 >> format short >> A A= 2.0000 5.0000 1.0000 3.5000 9.0000 8.0000 -2.0000 3.0000 6.0000 >> x=9;
  • 11. >> y=pi/6; >> A=[2,5,cos(y);sin(y),x^2,8;x/2 3 6] A= 2.0000 5.0000 0.8660 0.5000 81.0000 8.0000 4.5000 3.0000 6.0000 >> A(3 3)=0 ??? A(3 3)=0 | Error: Missing MATLAB operator. >> A(3,3)=0 A= 2.0000 5.0000 0.8660 0.5000 81.0000 8.0000 4.5000 3.0000 0 >> help sort SORT Sort in ascending or descending order. For vectors, SORT(X) sorts the elements of X in ascending order. For matrices, SORT(X) sorts each column of X in ascending order. For N-D arrays, SORT(X) sorts the along the first non-singleton dimension of X. When X is a cell array of strings, SORT(X) sorts the strings in ASCII dictionary order. Y = SORT(X,DIM,MODE) has two optional parameters. DIM selects a dimension along which to sort. MODE selects the direction of the sort 'ascend' results in ascending order 'descend' results in descending order The result is in Y which has the same shape and type as X. [Y,I] = SORT(X,DIM,MODE) also returns an index matrix I. If X is a vector, then Y = X(I). If X is an m-by-n matrix and DIM=1, then for j = 1:n, Y(:,j) = X(I(:,j),j); end When X is complex, the elements are sorted by ABS(X). Complex matches are further sorted by ANGLE(X). When more than one element has the same value, the order of the elements are preserved in the sorted result and the indexes of equal elements will be ascending in any index matrix.
  • 12. Example: If X = [3 7 5 0 4 2] then sort(X,1) is [0 4 2 and sort(X,2) is [3 5 7 3 7 5] 0 2 4]; See also issorted, sortrows, min, max, mean, median. Overloaded functions or methods (ones with the same name in other directories) help cell/sort.m help sym/sort.m help xregdesign/sort.m help sweepset/sort.m Reference page in Help browser doc sort >> A(2,5)=1 A= 2.0000 5.0000 0.8660 0 0 0.5000 81.0000 8.0000 0 1.0000 4.5000 3.0000 0 0 0 >> A(1) ans = 2 >> A(0) ??? Subscript indices must either be real positive integers or logicals. >> size(A) ans = 3 5 >> length(A) ans = 5
  • 13. >> x=1:6 x= 1 2 3 4 5 6 >> y=reshape(x,2,3) y= 1 3 5 2 4 6 >> y(:) ans = 1 2 3 4 5 6 >> R=[1 5 8;3 9 -6] R= 1 5 8 3 9 -6 >> S=[3.2 5 6;-1 0 3]; >> F=R+S*i F= 1.0000 + 3.2000i 5.0000 + 5.0000i 8.0000 + 6.0000i 3.0000 - 1.0000i 9.0000 -6.0000 + 3.0000i >> t=0:3:10 t= 0 3 6 9 >> s=0:5:-18 s=
  • 14. Empty matrix: 1-by-0 >> s=0:-5:-18 s= 0 -5 -10 -15 >> t=0:5 t= 0 1 2 3 4 5 >>>> A=[1 4 7 10;2 5 8 11;3 6 9 12] A= 1 4 7 10 2 5 8 11 3 6 9 12 >> B=[13 23 5 4 12;16 -24 -21 -18 10;14 0 28 -43 33;25 -3 -16 -1 11;13 -32 10 -20 -12] B= 13 23 5 4 12 16 -24 -21 -18 10 14 0 28 -43 33 25 -3 -16 -1 11 13 -32 10 -20 -12 >> A(8,3)=5 A= 1 4 7 10 2 5 8 11 3 6 9 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 >> B=[13 23 5 4 12;16 -24 -21 -18 10;14 0 28 -43 33;25 -3 -16 -1 11;13 -32 10 -20 -12] B=
  • 15. 13 23 5 4 12 16 -24 -21 -18 10 14 0 28 -43 33 25 -3 -16 -1 11 13 -32 10 -20 -12 >> A=[1 4 7 10;2 5 8 11;3 6 9 12] A= 1 4 7 10 2 5 8 11 3 6 9 12 >> A(3,8)=5 A= 1 4 7 10 0 0 0 0 2 5 8 11 0 0 0 0 3 6 9 12 0 0 0 5 >> x=1:8 x= 1 2 3 4 5 6 7 8 >> A=(x,2,4) ??? A=(x,2,4) | Error: Incomplete or misformed expression or statement. >> A=reshape(x,2,4) A= 1 3 5 7 2 4 6 8 >> x=1:8 x= 1 2 3 4 5 6 7 8 >> A=(1 2 3 4;5 6 7 8) ??? A=(1 2 3 4;5 6 7 8) |
  • 16. Error: Missing MATLAB operator. >> A=[1 2 3 4;5 6 7 8] A= 1 2 3 4 5 6 7 8 >> size(A) ans = 2 4 >> A(6) ans = 7 >> A=[1 2 3 4;5 6 7 8] A= 1 2 3 4 5 6 7 8 >> A(6) ans = 7 >> x=[1,2,3] x= 1 2 3 >> y=[1;2;3] y= 1 2 3 >> size(x)
  • 17. ans = 1 3 >> size(y) ans = 3 1 >> length(x) ans = 3 >> length(y) ans = 3 >> x=1:30 x= Columns 1 through 11 1 2 3 4 5 6 7 8 9 10 11 Columns 12 through 22 12 13 14 15 16 17 18 19 20 21 22 Columns 23 through 30 23 24 25 26 27 28 29 30 >> x=1:30; >> A=reshape(x,5,6) A= 1 6 11 16 21 26 2 7 12 17 22 27 3 8 13 18 23 28 4 9 14 19 24 29 5 10 15 20 25 30
  • 18. >> R=[1 2 3 4 5 6] R= 1 2 3 4 5 6 >> S=[1 2 3 4 5 6]; >> A=R+s*i ??? Error using ==> plus Matrix dimensions must agree. >> S S= 1 2 3 4 5 6 >> A=R+S*i A= Columns 1 through 4 1.0000 + 1.0000i 2.0000 + 2.0000i 3.0000 + 3.0000i 4.0000 + 4.0000i Columns 5 through 6 5.0000 + 5.0000i 6.0000 + 6.0000i >> A' ans = 1.0000 - 1.0000i 2.0000 - 2.0000i 3.0000 - 3.0000i 4.0000 - 4.0000i 5.0000 - 5.0000i 6.0000 - 6.0000i >> A'*A ans = 2 4 6 8 10 12 4 8 12 16 20 24 6 12 18 24 30 36 8 16 24 32 40 48
  • 19. 10 20 30 40 50 60 12 24 36 48 60 72 >> x=1:2:20 x= 1 3 5 7 9 11 13 15 17 19 >> length(x) ans = 10 >> x=0.2:0.3:3.5 x= Columns 1 through 7 0.2000 0.5000 0.8000 1.1000 1.4000 1.7000 2.0000 Columns 8 through 12 2.3000 2.6000 2.9000 3.2000 3.5000 >> y=sin(x) y= Columns 1 through 7 0.1987 0.4794 0.7174 0.8912 0.9854 0.9917 0.9093 Columns 8 through 12 0.7457 0.5155 0.2392 -0.0584 -0.3508 >> max(y) ans = 0.9917 >> length(y) ans =
  • 20. 12 >> sum(y)/length(y) ans = 0.5220 >> help mean MEAN Average or mean value. For vectors, MEAN(X) is the mean value of the elements in X. For matrices, MEAN(X) is a row vector containing the mean value of each column. For N-D arrays, MEAN(X) is the mean value of the elements along the first non-singleton dimension of X. MEAN(X,DIM) takes the mean along the dimension DIM of X. Example: If X = [0 1 2 3 4 5] then mean(X,1) is [1.5 2.5 3.5] and mean(X,2) is [1 4] Class support for input X: float: double, single See also median, std, min, max, cov. Overloaded functions or methods (ones with the same name in other directories) help fints/mean.m help sweepset/mean.m Reference page in Help browser doc mean >> mean(y) ans = 0.5220 >> help max MAX Largest component. For vectors, MAX(X) is the largest element in X. For matrices, MAX(X) is a row vector containing the maximum element from each column. For N-D arrays, MAX(X) operates along the first non-singleton dimension.
  • 21. [Y,I] = MAX(X) returns the indices of the maximum values in vector I. If the values along the first non-singleton dimension contain more than one maximal element, the index of the first one is returned. MAX(X,Y) returns an array the same size as X and Y with the largest elements taken from X or Y. Either one can be a scalar. [Y,I] = MAX(X,[],DIM) operates along the dimension DIM. When complex, the magnitude MAX(ABS(X)) is used, and the angle ANGLE(X) is ignored. NaN's are ignored when computing the maximum. Example: If X = [2 8 4 then max(X,[],1) is [7 8 9], 7 3 9] max(X,[],2) is [8 and max(X,5) is [5 8 5 9], 7 5 9]. See also min, median, mean, sort. Overloaded functions or methods (ones with the same name in other directories) help quantizer/max.m help fints/max.m help localpspline/max.m help localpoly/max.m Reference page in Help browser doc max >> [Y,y] = MAX(X) ??? Undefined function or variable 'X'. >> man(Y,y) ??? Undefined function or variable 'Y'. >> man(y) ??? Undefined command/function 'man'. >> max(y) ans = 0.9917 >> find(y==max(y))
  • 22. ans = 6 >> x=rand(5,1) x= 0.9501 0.2311 0.6068 0.4860 0.8913 >> sort(x) ans = 0.2311 0.4860 0.6068 0.8913 0.9501 >> help sort SORT Sort in ascending or descending order. For vectors, SORT(X) sorts the elements of X in ascending order. For matrices, SORT(X) sorts each column of X in ascending order. For N-D arrays, SORT(X) sorts the along the first non-singleton dimension of X. When X is a cell array of strings, SORT(X) sorts the strings in ASCII dictionary order. Y = SORT(X,DIM,MODE) has two optional parameters. DIM selects a dimension along which to sort. MODE selects the direction of the sort 'ascend' results in ascending order 'descend' results in descending order The result is in Y which has the same shape and type as X. [Y,I] = SORT(X,DIM,MODE) also returns an index matrix I. If X is a vector, then Y = X(I). If X is an m-by-n matrix and DIM=1, then for j = 1:n, Y(:,j) = X(I(:,j),j); end When X is complex, the elements are sorted by ABS(X). Complex matches are further sorted by ANGLE(X). When more than one element has the same value, the order of the
  • 23. elements are preserved in the sorted result and the indexes of equal elements will be ascending in any index matrix. Example: If X = [3 7 5 0 4 2] then sort(X,1) is [0 4 2 and sort(X,2) is [3 5 7 3 7 5] 0 2 4]; See also issorted, sortrows, min, max, mean, median. Overloaded functions or methods (ones with the same name in other directories) help cell/sort.m help sym/sort.m help xregdesign/sort.m help sweepset/sort.m Reference page in Help browser doc sort >> sort(x,ascend) ??? Undefined function or variable 'ascend'. >> sort(x,ascending) ??? Undefined function or variable 'ascending'. >> sort(x,'ascending') ??? Error using ==> sort sorting direction must be 'ascend' or 'descend'. >> sort(x,descend) ??? Undefined function or variable 'descend'. >> -sort(-x) ans = 0.9501 0.8913 0.6068 0.4860 0.2311 >> -x ans =
  • 24. -0.9501 -0.2311 -0.6068 -0.4860 -0.8913 >> a=-x a= -0.9501 -0.2311 -0.6068 -0.4860 -0.8913 >> sort(a) ans = -0.9501 -0.8913 -0.6068 -0.4860 -0.2311 >> -sort(-x) ans = 0.9501 0.8913 0.6068 0.4860 0.2311 >> sort(-x) ans = -0.9501 -0.8913 -0.6068 -0.4860 -0.2311 >> -sort(-a) ans =
  • 25. -0.2311 -0.4860 -0.6068 -0.8913 -0.9501 >>