[go: up one dir, main page]

0% found this document useful (0 votes)
8 views2 pages

Matlab_notebook_v2014_2

The document provides a comprehensive overview of MATLAB commands, functions, and operations, including statistical functions, file management, and data analysis techniques. It also outlines editor shortcuts, initialization commands, and various mathematical and trigonometric functions. Additionally, it covers error management, communication with the user, and performance analysis tools within MATLAB.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Matlab_notebook_v2014_2

The document provides a comprehensive overview of MATLAB commands, functions, and operations, including statistical functions, file management, and data analysis techniques. It also outlines editor shortcuts, initialization commands, and various mathematical and trigonometric functions. Additionally, it covers error management, communication with the user, and performance analysis tools within MATLAB.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

GETTING HELP DIMENSION STATISTICS / DATA ANALYSIS

help display help in command window (F1) length length of matrix cumsum cumulative sum
doc display hel in Matlab desktop numel number of matrix éléments sum sum
demo open demo size size of matrix mean mean value of matrix
SPECIAL CHARACTERS median median value of matrix
MATLAB FILE EXTENSIONS std
.m % comments standard deviation
Matlab code (function or script)
%% cell-break var variance
.mat binary files for data
! call DOS command min, max minimum, maximum
.fig saved files for figure
' surround strings or transpose of a matrix sort, sortrows sort matrix elementspro
EDITOR KEYBORS SHORTCUTS , separate éléments on the same lines prod product of matrix éléments
Ctrl + R / Ctrl + T comment / uncommet cumprod cumulative product
separate arguments of a function
Ctrl + I properly indent mode most frequent value in matrix
separate command on the same lines
Ctrl + Entrée run a code section trapz trapezoidal numerical integration
; end a command and disable display
F5 run a script
end a line when assigning a matrix RELATIONAL OPERATORS
F9 run selection () matrix indexation operator (line, column) ==, ~=, >, <, >=, <=
Ctrl + D open selection with editor [] matrix definition and concatenation operator LOGICAL OPERATORS
Ctrl + S save {} cells array definition and indexation operator & | ~ element wise AND, OR and NOT
Ctrl + G move down to a line : operator to create vector && || short-circuit AND, OR and NOT
Ctrl + F find a file >> a = 1 : 2 : 10
F1 open help/help on selection all determine if all array éléments are nonzero
… continue statement on the next line any
INITIALIZATIONS determine if any array element is nonzero
. decimal marker
startup init script of the environment (defined by the programmer) which indexation operator for structure fields COMPLEX NUMBER
automatically runs when opening Matlab, in the directory >> a = 12 + 5i
= assignment operator
containing startup.m real real part
CALCULATION imag imaginary part
clc clear the command window + - * / addition, substraction, multiplication, division abs complex magnitude
clear empty workspace \ left array divide (system of equations solving with least squares) angle phase angle
close all close all figures power conj complex conjugate
NAVIGATION . combined with arithmetic operator to calculate element by
cd display or change current directory STRINGS
element
dir list current directory contents handling
pwd
MATHEMATICAL FUNCTIONS str1 = 'une' ; str2 = 'chaîne' ;
display current directory sqrt square root str = [str1 ' ' str2] concatenate
path list search path abs absolute value lower, upper convert strings to lower/upper case
addpath add a path to search path
log natral logarithm strrep find and replace substring
rmpath remove path from search path
restoredefaultpath
exp exponential strvcat concatenate strings vertically
restore default search path
log10 common logarithm (base 10) strtrim remove leading and trailing white space from
SPECIAL CONSTANTS 10^ power of 10
ans give last results strings
mod, rem modulo, remainder after division strcmp, strcmpi, strncmp, strncmpi compare strings
eps machine accuracy
NaN Not a Number TRIGONOMETRIC FUNCTIONS string/number conversion
pi π constant sin, cos, tan sine, cosine, tangent int2str, mat2str, num2str convert integer, matrix or number to string
i, j imaginary number = sqrt(-1) asin, acos, atan arcsines, arccosines, arctangent str2double, str2num convert strings to double or number
true, false true, false atan2 four quadrant arctangent sprintf, sscanf write/read formatted data from string
inf infinite sec, csc, cot secant, cosecant, cotangent
FIGURES AND PLOT
realmax largest real programmable sinh, cosh, tanh hyperbolic sines, cosines, tangent figure create figure window
realmin smaller real programmable sech, csch, coth hyperbolic secant, cosecant, cotangent
close, close all close one or all figure(s)
computer computer running Matlab ROUNDING clf clear figure
MATRIX round round to nearest decimal or integer hold on/off/all retain current plot when adding new plots
ones create matrix of 1 ceil round to positive infinity subplot create axes in tiled positions
zeros create matrix of 0 floor round to negative infinity ED plots
eye create identity matrix fix round to zero plot 2D line plot
linspace generate linearly spaced vector stem, stairs plot discrete sequence data
logspace generate logarithmically spaced vectors semilogx, semilogy semi-logarithmic plot
rand, randn generate random numbers matrix loglog log-log scale plot
READ/WRITE FILES ERROR MANAGEMENT
couleurs marqueurs high level try
[1 1 0] 'y' 'yellow' '. ' 'v' dlmread, dlmwrite read/write ASCII delimited file of numeric data into % Matlab instruction
[1 0 1] 'm' 'magenta' 'o' '^' matrix catch
[0 1 1] 'c' 'cyan' 'x' '<' csvread, csvwrite read/write comma separated value (CSV) file % Matlab instruction
[1 0 0] 'r' 'red' '+' '>' xlsread, xlswrite read/write Microsoft Excel spreadsheet file end
[0 1 0] 'g' 'green' '*' 'p' wk1read, wk1write read/write Lotus file lasterr, lastwarn last error/warning message
[0 0 1] 'b' 'blue' 's' 'h' load, save read/write binary Matlab (.mat) warning display warning message
[1 1 1] 'w' 'white' 'd' imread, imwrite read/write image from graphics file error throw error and display message
[0 0 0] 'k' 'black' low level FUNCTION MANAGEMENT
3D plot 1 – open file 2 – locate, read, write… 3 – close file create a file MyFunction.m :
surf 3D shaded surface plot fopen, fclose open/close a file function [S1, S2, …] = MyFunction(E1, E2, …)
mesh mesh plot fread, fwrite read/write a binary file % MyFunction: quick description
plot3 3D line plot fprintf, fscanf read/write data from text file % header(display with help)
pcolor pseudocolor (checkerboard) plot fgetl, fgets read line from file, removing/keeping newline characters nargin, nargout number of function input/output arguments
feof nargchk calidate number of input arguments
other plots test for end of file
pie pie chart frewind move file position indicator to beginning of open file varargin, varargout input/ouput variables of function argument as a list
hist histogram plot ftell position in open file (cell array)
bar bar graph fseek move to specified position in files COMMUNICATION WITH USER
contour contour plot of matrix disp display value of variable in command window
CONTROL STRUCTURES
annotations for var = vector input display a message and request user input
legend legend % Matlab instruction pause halt exécution temporarily
xlabel, ylabel, zlabel axis labels end waitbar open or update wait bar dialog box
title add title to current axis if logical expression 1 % Mandatory inputdlg create dialog box that gathers user input
box axis border % Matlab instruction warndlg, errordlg, helpdlg create warning/error/hel dialog box
text create text object in current axis elseif logical expression 2 % Optional uigetfile, uiputfile create dialog box for getting/saving files
grid and scales % Matlab instruction PERFORMANCE ANALYSIS
grid display grid else % Optional tic, toc start/stop stopwatch timer (measure time)
axis, xlim, ylim, zlim axis limits % Matlab instruction profile profile exécution time for function
zoom turn zoom on or off end % Mandatory memory display memory information
linkaxes synchronize limits of specified 2D axis switch expression % String, double, boolean
colorbar POLYNOMIALS
colorbar showing color scale case value 1 % Mandatory poly polynomial with specified roots(coefficients calculation)
caxis color axis scaling % Matlab instruction
roots polynomial with specified coefficients(roots calculation)
colormaps case {value 2, value 3} % Optional
polyfit polynomial curve fitting
colormap view and set current colormap % Matlab instruction
otherwise % Optional but recommended
polyval polynomial evaluation
% Matlab instruction conv convolution and polynomial multiplication
end deconv deconvolution and polynomial division
while DATES
% Matlab instruction format
end chaîne format defined by 'dd' 'mm' 'yy' 'HH' 'MM' 'SS'
break terminate exécution of ‘for’ or ‘while’ loop nombre elapsed days since January 0, 0000
FILE MANAGEMENT continue pass control to next iteration of ‘for’ or ‘while’ loop vecteur [year month day hours minutes seconds]
edit open a file with Matlab editor return return control to invoking function conversion
which locate functions and files pause halt exécution temporarily datenum convert date and time to serial date number
copyfile copy files TESTING datestr convert date and time to string format
delete delete files isempty is empty?
datevec convert date and time to vector components
fileparts parts of file (name, path and extension) DateMatlab = DateExcel + datenum('30-Dec-1899');
isnan is NaN?
fullfile build full file name from parts exist exist? (variable, files, directory, …) autres
filesep file separator for current platform isequal is equal? date, now, clock current date
mkdir make new folder isinteger, isfloat is interger? is float? datetick format date with tick labels
rmdir remove new folder isnumeric is number? (integer, float but not boolean)
ischar is character array ?
isfinite, isinf is finite/infinite?

You might also like