matlab1

52
MATLAB 程程程程程程程 陳陳陳 [email protected] [email protected]

Upload: gtra389

Post on 18-Nov-2015

1 views

Category:

Documents


0 download

DESCRIPTION

MATLAB1

TRANSCRIPT

  • MATLAB [email protected]@gmail.com

  • http://140.114.78.121/~mikemouse/light-bot.swf

  • Matlab

  • Workspace

  • Array Editormat

  • 1.3 1.3.1

  • 1.3.2 MatlabPreferences

  • helplookfor help helpwin helpdesk MATLAB doc

  • help>> help sqrt

  • doc>> doc sin

  • Matlab

  • MATLAB Command Window>> Enter

    >> (5*2+3.5)/5 ans = 2.7000

    MATLAB ;

    >> (5*2+3.5)/5;

  • 32

  • Comments%

    >> y = (5*2+3.5)/5; % y >> z = y^2 % z z = 7.2900

  • whowhosclear

  • Matlab permanent constant

  • Matlab

    degree radian

  • Matlab

  • 2.2.2

    Matlabn

  • Matlab i j

  • Matlab

  • arrayvectormatrixrow vectorcolumn vector

  • 2.3.1 Matlab

    >> A = [1 2 3 4]; % 14 A>> A % A A = 1 2 3 4

  • Matlab

  • Matlab

  • MATLAB t = [3,7,11,5]

    >> t(3) = 2 % t 2 t = 3 7 2 5 >> t(6) = 10% t 10 t = 3 7 2 5 0 10

    >> t(4) = [] % t [] t = 3 7 2 0 10

  • 2.3.2 matrixmnmn

  • mxn>> A(2,3) = 5 % A 5

    A = 1 2 3 4 5 6 5 8 9 10 11 12

    >> B = A(2,1:3) % A B

    B = 5 6 5

  • mxn>> A = [A B'] % B A

    A = 1 2 3 4 5 5 6 5 8 6 9 10 11 12 5 >> A(:, 2) = [] % A []

    A = 1 3 4 5 5 5 8 6 9 11 12 5

  • mxn>> A = [A; 4 3 2 1] % A

    A = 1 3 4 5 5 5 8 6 9 11 12 5 4 3 2 1

    >> A([1 4], :) = [] % []

    A = 5 5 8 6

  • 2.4 Matlab 2.4.1 Matlab

  • 2.4.2 ...

  • 2.4.3 Matlab

    9 9

    10000.001 Matlab4

  • format

  • MatlabMatlab

  • singledouble

  • n-bit

    signedunsigned 8163264bits

  • Matlabbytes

  • Matlab1true0false

  • MATLAB LoopsConditionsFlow Controlfor

    For = 1 : 2 ; end

  • while While-loop

    while ; end

    if else end

    if ; else ; end

  • M MATLAB m MATLAB

    >> pwd % >> cd d:\matlabBook\MATLAB\02- MATLAB>> type myTest.m % myTest.m >> myTest % myTest.m

  • M_dispdisp(' Corn Oats Hay')disp(A)

  • MATLAB path

    >> path

    which

    MATLAB addpath

  • MATLAB Base WorkspaceWorkspace)Workspace who whos

  • clear Optionssave Binary mat save matlab.mat save filename filename.mat save filename x y z xyz filename.mat

  • MATLAB exit quit MATLAB