?? matrices.m
字號:
%%% Some examples of basic array and matrix manipulations%% Cleanup the environmentclear; % clear the workspace clc; % clean the screen%% To create a vectorv = [1.0 2 3.0 4.0]fprintf('press enter to continue \n');pause%% To create a a 2x4 matrixA = [4.0 5.0 7.0 8.0; 9.0 10.0 11.0 12.0]fprintf('press enter to continue \n');pause%% To create a main diagonal matrixD = diag(v)fprintf('press enter to continue \n');pause%%4x4 identity matrixeye(4)fprintf('press enter to continue \n');pause%% Combine the blocks D and the 4x4 identity into an 8x4 matrix%% notice the answer is left in the special variable ans[D; eye(4)]fprintf('press enter to continue \n');pause%% a 3x3 matrix of all zeros (done 2 different ways)Z = zeros(3)Z = zeros(3,3)fprintf('press enter to continue \n');pause%% a matrix of all onesO = ones(2,3)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -