Generated reference › Command glossary — console commands, verbs, functions
kind: generated#commands#catalog#console#glossary

Command glossary — console commands, verbs, functions

Everything the console understands: 66 registered commands, 15 keywords, 990 matrix functions and 84 recipe verbs. ICoreCommandGlossary is the one catalog the app itself builds from these sources — it feeds the glossary command, help <name>, Tab completion, the suggestion popup and the script highlighter.

Run one headlessly: ICoreBlocks --console "<command line>" — a bare --console with no command hangs forever, so always pass the command. The binary is the app bundle, not the loose build-mac/ICoreBlocks.

Commands#

CommandWhat it doesRegistered in
agentBridgeWhether coding agents can reach this app through the icore client, and whether their changes are checked in a separate process first: agentBridge [status\|on\|off], agentBridge check [on\|off]ICoreAgentCommands.cpp
agentCheckCheck a coding agent's change in THIS process and exit -- the separate process the app (and icore check) starts so a model that crashes or hangs cannot take the app down: agentCheck [<job folder>]; the folder holds job.json and receives verdict.jsonICoreAgentCommands.cpp
agentGuideThe instruction files a coding agent reads in the open project, and whether new projects get them: agentGuide [status\|write\|refresh\|on\|off]ICoreAgentCommands.cpp
agentServeServe the agent bridge from a headless --console run: agentServe [seconds] [--project <folder>]ICoreAgentCommands.cpp
checkUpdates—ICoreUpdateCommands.cpp
clcClear the active output log (MATLAB's name for cls)ICoreWorkspaceCommands.cpp
clearRemove variables: clear, clear x y, clear all (the output log is clc/cls)ICoreWorkspaceCommands.cpp
clearAllClear all logs, the variables space, and recipe handlesICoreCommandSamples.cpp
clearAllLogsClear all output logsICoreCommandSamples.cpp
clearCommandHistoryForget every command line recalled by the Up arrow, in this session and previous onesICoreCommandHistoryStore.cpp
clearRecipeHandlesClear all recipe handle bindingsICoreCommandSamples.cpp
clearVariablesSpaceClear all variables from the variables spaceICoreCommandSamples.cpp
clearvarsRemove variables: clearvars, clearvars x y (same as clear)ICoreWorkspaceCommands.cpp
clsClear the current output logICoreCommandSamples.cpp
COMMAND_GETPrint one simulation/solver setting: getModelConfig <property>ICoreModelConfigCommands.cpp
COMMAND_PRINTPrint every simulation/solver setting and its current valueICoreModelConfigCommands.cpp
COMMAND_SETSet one simulation/solver setting: setModelConfig <property> <value>ICoreModelConfigCommands.cpp
commandParityPrepare—ICoreCommandParityCommands.cpp
diagramExportVerify—ICoreParityDiagramCommands.cpp
diagramPrepare—ICoreParityDiagramCommands.cpp
docsSample—ICoreDocsSampleCommands.cpp
drawnowAccepted and does nothing: this console draws on the thread the script runs on, so there is never a queued repaint to flushICoreWorkspaceCommands.cpp
echoPrint the arguments backICoreCommandSamples.cpp
exportVerify—ICoreParityCommands.cpp
formatDisplay precision: format short (the default) or format longICoreWorkspaceCommands.cpp
fromMatlab—ICoreMatlabCommandBridge.cpp
generateRecipePrint a recipe script reproducing a subsystem's block diagram (default: Home)ICoreCommandSamples.cpp
glossaryList all commands, matrix functions, and syntaxICoreCommandSamples.cpp
guiBless—ICoreGuiRegressionCommands.cpp
guiList—ICoreGuiRegressionCommands.cpp
guiTest—ICoreGuiRegressionCommands.cpp
helpList all registered commands, or help <name> for one glossary entryICoreCommandEngine.cpp
licenseStatus—ICoreAccountCommands.cpp
matlabExportScript—ICoreMatlabCommandBridge.cpp
matlabImportScript—ICoreMatlabCommandBridge.cpp
messageTraffic—ICoreMessageTrafficCommands.cpp
name—ICoreCommandEngine.cpp
navigationRootAccessPrint whether the tree above Home (Root / Temp / Trash) is reachableICoreNavigationCommands.cpp
openTemplateOpen any template as a new project: openTemplate <id> [name]ICoreTemplateCommands.cpp
parityExport—ICoreParityCommands.cpp
parityPrepare—ICoreParityCommands.cpp
regress—ICoreConsoleRegressionCommands.cpp
regressBless—ICoreConsoleRegressionCommands.cpp
regressCoverage—ICoreConsoleRegressionCommands.cpp
regressionList—ICoreRegressionCommands.cpp
regressionTest—ICoreRegressionCommands.cpp
regressList—ICoreConsoleRegressionCommands.cpp
reloadProjectRe-read the open project from its folder, after its files were edited outside the app (what was on screen is kept in .icore/before-reload.iproj)ICoreAgentCommands.cpp
reverseReverse the given textICoreCommandSamples.cpp
runRun a saved script in this workspace: run <name>ICoreWorkspaceCommands.cpp
saveTemplateSave the current diagram level as a reusable subsystem template: saveTemplate <name>ICoreTemplateCommands.cpp
setNavigationRootAccessShow or hide the tree above Home: setNavigationRootAccess <on\|off>ICoreNavigationCommands.cpp
simulateRun the model to its stop time and summarise the signals: simulate [--csv <file>] [block, block, ...]. With no blocks it watches every sink (Scope, Display, ...)ICoreSimulationCommands.cpp
solverParityPrepare—ICoreParitySolverCommands.cpp
targetsList the Deploy to Hardware targets: name, language, source subsystem, folder. t = target(<language>) makes one; t.listConfig shows its settings; t.fire() exportsICoreScriptTargets.cpp
templatesList the ready-to-use diagram templates (optionally filtered by category or kind)ICoreTemplateCommands.cpp
terminalHostsThe processes that keep the Terminal panel's shells alive if the app crashes: terminalHosts [list], terminalHosts end <host pid>, terminalHosts end left-behindICoreAgentCommands.cpp
tffitMethodsList the system-identification estimators tffit() accepts, with a summary of each (this is ICore's own family; MATLAB's tfest has no such list)ICoreMathToolCommands.cpp
timeSeriesDemoDeclare a demo time series in the variables space (default name: demoSignal)ICoreCommandSamples.cpp
toMatlab—ICoreMatlabCommandBridge.cpp
toolchain—ICoreToolchainCommands.cpp
trim-slashesStrip leading/trailing slashes from a pathICoreCommandSamples.cpp
useTemplateInsert a subsystem template into a diagram level: useTemplate <id> [parent] [x] [y]ICoreTemplateCommands.cpp
versionShow the product version, commit and build dateICoreCommandSamples.cpp
whoList the names of the variables in the workspaceICoreWorkspaceCommands.cpp
whosList the variables with their size, byte count and classICoreWorkspaceCommands.cpp

Keywords#

The words that are syntax rather than a name: the console recognises them, it does not look them up. A block spans lines and is complete when its end closes it — the prompt shows that a block is open while you type one. Running a block is not built yet: the console reads the whole block and then declines it, saying so plainly, rather than mistaking a keyword for a command it has never heard of.

KeywordSignatureOpens a blockMeaning
ifif cond … elseif cond … else … endyesRun the first branch whose condition holds; a condition holds when it is non-empty and every element of it is non-zero
elseifelseif cond—A further condition inside an open if block
elseelse—The branch an if takes when none of its conditions held
forfor name = expr … endyesRepeat the body once per COLUMN of expr (so once per element of a range or a row vector); the loop variable keeps its last value afterwards
whilewhile cond … endyesRepeat the body for as long as the condition holds
switchswitch expr … case value … otherwise … endyesRun the first case arm whose value matches expr
casecase value—One arm of an open switch block
otherwiseotherwise—The arm a switch takes when no case matched
breakbreak—Leave the innermost for or while body
continuecontinue—Skip to the next iteration of the innermost for or while body
returnreturn—Stop the running script; inside a script-defined function, return from it
functionfunction [o1, o2] = name(a, b) … endyesDefine a session-scoped function with its own workspace
trytry … catch err … endyesRun the body and hand a failure to the catch arm instead of stopping the script
catchcatch err—The arm a try takes when its body failed; err binds the error
endend—Close the innermost open block. Not an index yet: A(end) is C1.10

Recipe verbs#

Block-diagram statements, handled by ICoreRecipeInterpreter before the math grammar. These are what a .icore template is written in (Template catalog — every .icore).

VerbSignatureMeaning
addPortp = handle.addPort(in|out, type?, facing?)Add a port to a block (type defaults to ICoreDouble; refused if that port list is private). Types:
applyStylelinePathHandle.applyStyle(styleBlob)Apply a ";"-joined ICoreChartLinePath::captureStyle blob (color, pen, visibility, ...) — round-trip, not meant for hand-authoring
areaa? = area(parent?)Create a canvas work area (parent defaults to Home)
autoArrangesubsystemHandle.autoArrange()Auto-arrange every block in a subsystem (handle must be a subsystem's block, as bound by subsystem())
blockhandle = block(type, parent?)Create a block (parent defaults to Home) and bind it to a handle
chartc = handle.chart()Bind a handle to a block's attached chart (Scope-type blocks only) — behaves like a plot() chart handle
clearchartHandle.clearDelete every line path on a chart
clearAllSelectionsselectionModelHandle.clearAllSelectionsDrop everything a selection model currently holds
clearDiagramclearDiagram(parent?, keepPorts?)Permanently delete everything in a subsystem (defaults to Home); with keepPorts its input/output gates stay, so the level above keeps its links
clearImageimageHandle.clearImageDrop an image holder's picture, back to the placeholder
clearPortshandle.clearPorts()Delete every port on the block's non-private port lists
commentOuthandle.commentOutComment out a block so it is excluded from the run
connectl? = connect(out<i>|branchHandle, in<j>)Link an output port to an input port (operands may also be port handles), or — with a link-branch handle first — branch that link toward a free input port; l = ... binds the created (root) branch
defineEnumdefineEnum(Name, {Member1, Member2, ...}, [value1 value2 ...], Default?)Define (or replace) a project enumeration type, as Simulink.defineIntEnumType does: identifier names, int32 values (a shared value is an alias), the default member or else the first; saved with the project and its global variables
deletehandle.deletePermanently delete a block, link branch, area, image or textbox (no trash, no undo); deleting a link's root branch deletes the whole link
deselectAreaselectionModelHandle.deselectArea(areaHandle)Remove a canvas area from a selection model
deselectBlockselectionModelHandle.deselectBlock(blockHandle)Remove a block from a selection model
deselectImageselectionModelHandle.deselectImage(imageHandle)Remove an image holder from a selection model
deselectLinkBranchselectionModelHandle.deselectLinkBranch(branchHandle)Remove a link branch from a selection model
deselectTextBoxselectionModelHandle.deselectTextBox(textboxHandle)Remove a text box from a selection model
disableFlushingTimerchartHandle.disableFlushingTimerStop the auto-flush timer (flushing whatever is buffered once more first)
disconnectportHandle.disconnectDetach the port from its link branch; the link stays, with that end left dangling
duplicateselectionModelHandle.duplicate(destination?, dx?, dy?)Clone everything selected into a subsystem (destination defaults to Home), offsetting position by (dx, dy) (+y up, defaults to (0, 0)); clears the model's selection when done
enableFlushingTimerchartHandle.enableFlushingTimerStart auto-flushing buffered points (from pushPoint) onto the chart every 100ms
exportAsEPSchartHandle.exportAsEPS(path)Export a chart to an Encapsulated PostScript file
exportAsImagechartHandle.exportAsImage(path)Export a chart to a png/jpg image (format from the extension)
exportAsPDFchartHandle.exportAsPDF(path)Export a chart to a PDF file
exportAsSVGchartHandle.exportAsSVG(path)Export a chart to an SVG file
exportDataCSVchartHandle.exportDataCSV(path)Export a chart's plotted data to a CSV file
firetargetHandle.fire()Export the target's source subsystem as code, now, as configured (t.setConfig Name/Language/Source/Folder/Verification/Tolerance/...; t.listConfig shows them). Reports the files written, or every error; never opens a dialog -- a verification failure stops the export and is reported
getv? = handle.get(property)Print one block property (name, path, x, y, width, ...); v = ... stores a numeric snapshot in the variables space
getBlockhandle = getBlock(path)Bind a handle to a block that already exists, by its level path and name: getBlock(Gain1), getBlock(Home/Controller/Gain1). Chains like block(): getBlock(Home/Gain1).setConfig(Gain Value, 2)
getBufferWidthchartHandle.getBufferWidthPrint a chart's streaming buffer width
getConfigv? = handle.getConfig(variableName)Print one non-private block config variable; v = ... stores a numeric snapshot in the variables space
getCornersbranchHandle.getCornersPrint a link branch's path corners in the same '(x, y), ...' form setCorners accepts
getTargett = getTarget(name)Bind a handle to a Deploy to Hardware target that already exists, by name (targets lists them)
getTexttextboxHandle.getTextPrint a text box's text
getTitleareaHandle.getTitlePrint a canvas area's title bar text
hideNamehandle.hideNameHide the name label drawn under a block
holdOnchartHandle.holdOn(matrix)Plot another matrix onto an existing chart, keeping its current lines. Reads the matrix the CHART's way -- column 0 is x, every later column a line -- which is the shape a recorded series lands in; plot() reads MATLAB's way instead (C13.1), so the two differ on purpose
ICoreString::fromLatin1(name)ICoreString::fromUtf8(signature)ICoreString::fromUtf8(description)
imagei? = image(parent?)Create an image holder (parent defaults to Home)
infohandle.infoPrint the block's full property sheet
inputPortp = handle.inputPort(i)Bind a handle to a block's existing input port [i], or chain a port method: handle.inputPort(i).disconnect()
isInfiniteStreamingchartHandle.isInfiniteStreamingPrint whether infinite streaming is on for a chart
listConfighandle.listConfigPrint the block's non-private config variables
loadImageimageHandle.loadImage(path)Load a picture from disk into an image holder (quotes optional)
loglogc? = loglog(...)plot() with both axes base-10 logarithmic; same arguments
migrateselectionModelHandle.migrate(destination?, dx?, dy?)Move everything selected into a subsystem (destination defaults to Home), offsetting position by (dx, dy) (+y up, defaults to (0, 0)); clears the model's selection when done
movehandle.move(x, y)Move a block, area, image or textbox relative to the origin anchor (+y is up)
optimizeLinkssubsystemHandle.optimizeLinks()Re-run the link path optimizer over every block in a subsystem (handle must be a subsystem's block, as bound by subsystem())
outputPortp = handle.outputPort(i)Bind a handle to a block's existing output port [i], or chain a port method: handle.outputPort(i).disconnect()
pathp? = chartHandle.path(i)Bind a handle to one of a chart's existing line paths
plotc? = plot(y) | plot(x, y) | plot(x, y, 'r--o') | plot(x1, y1, x2, y2) | plot(..., 'LineWidth', 2) | plot(series) | plot(f) | plot(f, x, y[, outliers][, type][, level][, spec])Create a standalone chart window and plot into it, with MATLAB's plot grammar: y alone puts every column against the row index 1..n, (x, y) puts y against x, a quoted line spec styles the group (colour rgbcmykw, line - -- : -., marker o s d x + * .), x/y pairs repeat, and trailing 'Name', value pairs (LineWidth, LineStyle, Color, Marker, MarkerSize) apply to every line. plot(series) is this console's own extra: a recorded signal against its own time, one line per channel. A FIT (T8.11) takes MATLAB's own cfit overload instead: plot(f) draws the curve over the fit's own data range, plot(f, x, y) adds the data, and a plot type -- fit, residuals, predobs, predfunc, deriv1, deriv2, integral, or a braced list of them for one axes each -- says what to draw. Does not touch the block diagram
pushPointlinePathHandle.pushPoint(x, y)Buffer one point onto a line path (pair with the chart's enableFlushingTimer to see it appear)
removePorthandle.removePort(portHandleOrName)Delete one port from a block (refused if that port list is private)
renamehandle.rename(newName)Rename a block (name must be unique, no special characters)
resizehandle.resize(width, height)Set the width and height of a block, area, image or textbox
rotatehandle.rotate(angle)Set a block's rotation in degrees
selectAreaselectionModelHandle.selectArea(areaHandle)Add a canvas area to a selection model (refused if not a sibling of the model's current selection)
selectBlockselectionModelHandle.selectBlock(blockHandle)Add a block to a selection model (refused if not a sibling of the model's current selection)
selectImageselectionModelHandle.selectImage(imageHandle)Add an image holder to a selection model (refused if not a sibling of the model's current selection)
selectionModels = selectionModel()Create a standalone canvas selection model (not tied to any canvas/tab, does not touch the diagram); the handle must be bound
selectLinkBranchselectionModelHandle.selectLinkBranch(branchHandle)Add a link branch to a selection model (the whole link if it's the root branch); refused if not a sibling of the model's current selection
selectTextBoxselectionModelHandle.selectTextBox(textboxHandle)Add a text box to a selection model (refused if not a sibling of the model's current selection)
semilogxc? = semilogx(...)plot() with a base-10 logarithmic x axis; same arguments
semilogyc? = semilogy(...)plot() with a base-10 logarithmic y axis; same arguments
setAxisFontchartHandle.setAxisFont(x|y, fontBlob)Set an axis label's font from a ";"-joined ICoreStudioStaticCommands::serializeFont blob (round-trip, not meant for hand-authoring)
setColorareaHandle.setColor(r, g, b[, a] | nameOrHex)Set a canvas area's color (0-255 channels, or a named/#rrggbb color)
setConfighandle.setConfig(variableName, value)Set a non-private block config variable
setCornersbranchHandle.setCorners((x1, y1), (x2, y2), ...)Set a link branch's path corners (at least 2), relative to the origin anchor (+y is up, like move)
setDescriptionportHandle.setDescription(text)Set a port's description label (empty text clears it)
setInfiniteStreamingchartHandle.setInfiniteStreaming(true|false)Toggle whether a chart keeps only the last getBufferWidth() points per line
setMovingWindowWidthchartHandle.setMovingWindowWidth(n)Set how many points a streaming chart keeps per line
setPathNamelinePathHandle.setPathName(text)Rename a chart line path
setTexttextboxHandle.setText(text)Set a text box's text (quotes optional; empty clears)
setTitleareaHandle.setTitle(text)Set a canvas area's title bar text (quotes optional)
showNamehandle.showNameShow the name label under a block again
subsystemhandle = subsystem(parent?)Create a subsystem (parent defaults to Home); the handle binds to its block
targett = target(language)Create a Deploy to Hardware target (the Deploy panel's own list) in Python, MATLAB, Java, Rust, C++, C, System Verilog, Verilog, VHDL or PLC - ST. It exports Home into <project>/code/<name> until setConfig says otherwise
textboxt? = textbox(parent?)Create a canvas text box (parent defaults to Home)
uncommenthandle.uncommentRe-include a commented-out block in the run
xlabelchartHandle.xlabel(text)Set a chart's X-axis label
ylabelchartHandle.ylabel(text)Set a chart's Y-axis label

Matrix functions#

From ICoreExpressionEvaluator::functions() — usable in any expression the console or a config field evaluates. Most of these names are core MATLAB; the ones that come from a toolbox are grouped under it, so a name that needs a licence on the other side is never mistaken for one that does not.

Core MATLAB#

FunctionSignatureMeaning
transposetranspose(A)Transpose of A (same as A.')
ctransposectranspose(A)Conjugate transpose of A (same as A'); identical to transpose on real data
plusplus(A,B)A + B
minusminus(A,B)A - B
uminusuminus(A)-A
uplusuplus(A)+A
mtimesmtimes(A,B)A * B (matrix product)
timestimes(A,B)A .* B (element-wise product)
mrdividemrdivide(A,B)A / B (right division; A*inv(B) for square B)
rdividerdivide(A,B)A ./ B (element-wise division)
mldividemldivide(A,B)A \\ b (solves A*x = b; least squares when A is tall)
ldivideldivide(A,B)A .\\ B (element-wise, same as B ./ A)
powerpower(A,B)A .^ B (element-wise power)
invinv(A)Inverse of a square matrix A
pinvpinv(A[,tol])Moore-Penrose pseudo-inverse of A; singular values at or below tol are treated as zero (default max(size(A)) * eps(largest))
detdet(A)Determinant of a square matrix A
tracetrace(A)Sum of the diagonal of a square matrix A
condcond(A[,p])Condition number in the p-norm (p = 1, 2, Inf or "fro"); cond(A) is the 2-norm ratio max/min singular value
rcondrcond(A)Reciprocal condition estimate in the 1-norm, 1/(norm(A,1)*norm(inv(A),1)); 0 for a singular A
sqrtmsqrtm(A)Principal matrix square root of a square A -- complex when A has a negative eigenvalue, real when it does not
residue[r,p,k]=residue(b,a)Partial fraction expansion of b(s)/a(s): b/a = r(1)/(s-p(1)) + ... + k(s). A repeated pole takes consecutive terms of RISING power; k is empty when b is of lower degree than a
cholchol(A[,"lower"]) / [R,p] = chol(A)Cholesky UPPER factor R, A = R'*R (SPD A); "lower" gives L; [R, p] answers p = 0 for an SPD A and otherwise the pivot where it failed
nullnull(A[,"r"])Orthonormal basis for the null space of A, as columns; "r" gives MATLAB's rational basis
svdsvd(A[,"econ"]) / [U,S,V] = svd(A)Singular values as a column, or the three factors A = U*S*V'
qrqr(A[,"econ"]) / [Q,R] = qr(A) / [Q,R,P] = qr(A)QR: one output is R; two are A = Q*R; three are the column-pivoted A*P = Q*R
lulu(A) / [L,U] = lu(A) / [L,U,P] = lu(A)LU with partial pivoting: one output writes both factors into one matrix, two give A = L*U with the permutation folded into L, three give P*A = L*U
ldlldl(A[,"lower"]) / [L,D,P] = ldl(A)LDL of a symmetric A: one output is L, two give A = L*D*L', three give P'*A*P = L*D*L'
eigeig(A[,B]) / [V,D] = eig(A)Eigenvalues as a column (complex when they are); [V,D] gives A*V = V*D, [V,D,W] adds the left eigenvectors, eig(A,B) is the generalized problem
eigveceigvec(A)Eigenvectors of a square matrix A (real part)
expmexpm(A)Matrix exponential (square A)
logmlogm(A)Matrix logarithm (square A)
existexist("name"[,"var"|"builtin"])1 if name is a variable, 5 if it is a console function, 0 otherwise
isvarnameisvarname("name")1 when name is a legal variable name (letter first, letters/digits/_ after, not a keyword)
hesshess(A) / [P,H] = hess(A)Upper Hessenberg form H, A = P*H*P' with P orthogonal (square A)
schurschur(A[,"real"]) / [U,T] = schur(A)Real Schur form T, A = U*T*U' with U orthogonal; a complex eigenvalue pair is a 2x2 diagonal block
balancebalance(A[,"noperm"]) / [T,B] = balance(A)Diagonal scaling by powers of two (and a permutation unless "noperm"), B = T\\A*T -- conditions A for an eigenvalue solver
rankrank(A[,tol])Number of singular values above tol; the default tol is MATLAB's max(size(A))*eps(norm(A,2))
solvesolve(A,b)Solve A*x = b (extra: the same operation as A \\ b)
diagdiag(A[,k])Vector -> diagonal matrix; matrix -> its diagonal as a vector; k picks the k-th diagonal
kronkron(A,B)Kronecker product of A and B
dotdot(A,B[,dim])Scalar product of two vectors; column by column (dim 1) or row by row (dim 2) for two matrices -- MATLAB's reading, not the older sum over every element
horzcathorzcat(A,B[,C])Join side by side -- the function form of [A, B]
vertcatvertcat(A,B[,C])Stack -- the function form of [A; B]
catcat(dim,A,B[,C])Join along dim: 1 stacks, 2 joins side by side
crosscross(a,b)Cross product of two 3x1 vectors
powpow(A,B)Element-wise power A.^B (extra: the same operation as power)
qrqqrq(A)QR decomposition: orthogonal factor Q
qrrqrr(A)QR decomposition: upper-triangular factor R
lullul(A)LU decomposition: lower factor L (square A)
luuluu(A)LU decomposition: upper factor U (square A)
luplup(A)LU decomposition: permutation matrix P, P*A = L*U
svdusvdu(A)SVD: left singular vectors U
svdvsvdv(A)SVD: right singular vectors V
ldltlldltl(A)LDLT decomposition: unit lower factor L (symmetric A)
ldltdldltd(A)LDLT decomposition: diagonal D as a column vector
ldltpldltp(A)LDLT decomposition: permutation matrix P, P^T*L*diag(D)*L^T*P = A
issymmetricissymmetric(A)1 if A is symmetric, else 0
ispdispd(A)1 if A is symmetric positive-definite, else 0
pipi3.141592653589793; a variable named pi shadows it
InfInf / Inf(n) / Inf(m,n)Positive infinity, or an m x n matrix of it (also spelled inf)
NaNNaN / NaN(n) / NaN(m,n)Not-a-Number, or an m x n matrix of it (also spelled nan)
epseps / eps(x)2.220446049250313e-16, or the distance from x to the next double
realmaxrealmaxLargest finite double, 1.7976931348623157e308
realminrealminSmallest normalized positive double, 2.2250738585072014e-308
flintmaxflintmaxLargest consecutive integer a double represents exactly, 2^53
truetrue / true(n) / true(m,n)Logical 1, or an m x n logical array of it
falsefalse / false(n) / false(m,n)Logical 0, or an m x n logical array of it
absabs(A)Element-wise absolute value
expexp(A)Element-wise exponential
loglog(A)Element-wise natural logarithm
sqrtsqrt(A)Element-wise square root; a negative entry answers a complex number, as MATLAB's does (sqrt(-1) is 1i)
log2log2(A)Element-wise base-2 logarithm; [f, e] = log2(x) splits x into f * 2^e with f in [0.5, 1), and that form takes a negative x
log10log10(A)Element-wise base-10 logarithm
sinsin(A)Element-wise sine (radians)
coscos(A)Element-wise cosine (radians)
tantan(A)Element-wise tangent (radians)
eminemin(A,B)Element-wise minimum (B may be a scalar)
emaxemax(A,B)Element-wise maximum (B may be a scalar)
clampclamp(A,lo,hi)Clamp every element of A into [lo,hi]
mpowermpower(A,n)Matrix power A^n (square A, integer n; negative uses inverse)
signsign(A)-1, 0 or 1 per element (NaN stays NaN)
floorfloor(A)Element-wise round toward minus infinity
ceilceil(A)Element-wise round toward plus infinity
fixfix(A)Element-wise round toward zero
roundround(A[,n[,"significant"]])Round half away from zero; n decimal places, or n significant digits
secsec(A)Element-wise secant, 1/cos (radians)
csccsc(A)Element-wise cosecant, 1/sin (radians)
cotcot(A)Element-wise cotangent, 1/tan (radians)
sinhsinh(A)Element-wise hyperbolic sine
coshcosh(A)Element-wise hyperbolic cosine
tanhtanh(A)Element-wise hyperbolic tangent
deg2raddeg2rad(A)Degrees to radians
rad2degrad2deg(A)Radians to degrees
expm1expm1(A)exp(A)-1, keeping the digits near zero
log1plog1p(A)log(1+A), keeping the digits near zero; refuses below -1
sindsind(A)Sine of an angle in DEGREES; sind(180) is exactly 0
cosdcosd(A)Cosine of an angle in degrees; cosd(90) is exactly 0
tandtand(A)Tangent of an angle in degrees; tand(90) is Inf
secdsecd(A)Secant of an angle in degrees, 1/cosd
cscdcscd(A)Cosecant of an angle in degrees, 1/sind
cotdcotd(A)Cotangent of an angle in degrees, 1/tand
asindasind(A)Arcsine in degrees; refuses outside [-1,1]
acosdacosd(A)Arccosine in degrees; refuses outside [-1,1]
atandatand(A)Arctangent in degrees
asinasin(A)Arcsine in radians; refuses outside [-1,1]
acosacos(A)Arccosine in radians; refuses outside [-1,1]
atanatan(A)Arctangent in radians
asecasec(A)Arcsecant, acos(1/A); refuses inside (-1,1)
acscacsc(A)Arccosecant, asin(1/A); refuses inside (-1,1)
acotacot(A)Arccotangent, atan(1/A); acot(0) is pi/2 and acot(-0) is -pi/2
sechsech(A)Hyperbolic secant, 1/cosh
cschcsch(A)Hyperbolic cosecant, 1/sinh; csch(0) is Inf
cothcoth(A)Hyperbolic cotangent, 1/tanh; coth(0) is Inf
asinhasinh(A)Inverse hyperbolic sine
acoshacosh(A)Inverse hyperbolic cosine; refuses below 1
atanhatanh(A)Inverse hyperbolic tangent; atanh(1) is Inf, refuses outside [-1,1]
asechasech(A)Inverse hyperbolic secant, acosh(1/A); asech(0) is Inf, refuses outside [0,1]
acschacsch(A)Inverse hyperbolic cosecant, asinh(1/A); acsch(0) is Inf
acothacoth(A)Inverse hyperbolic cotangent, atanh(1/A); acoth(1) is Inf, refuses inside (-1,1)
erferf(A)Error function
erfcerfc(A)Complementary error function, 1-erf(A)
erfinverfinv(A)Inverse error function; NaN outside [-1,1], as in MATLAB
erfcinverfcinv(A)Inverse complementary error function; NaN outside [0,2]
gammagamma(A)Gamma function; Inf at every non-positive integer
gammalngammaln(A)log(gamma(A)) without the overflow; refuses a negative entry
gammaincgammainc(x,a[,"upper"])Regularized incomplete gamma, lower tail by default
gammaincinvgammaincinv(p,a)The x with gammainc(x,a) = p -- base MATLAB's inverse incomplete gamma, and what gaminv and chi2inv are written over. Same bracketed Newton as betaincinv
betabeta(a,b)Beta function, exp(betaln(a,b))
betalnbetaln(a,b)log(beta(a,b)) without the overflow
betaincbetainc(x,a,b[,"upper"])Regularized incomplete beta; x must be in [0,1]
betaincinvbetaincinv(p,a,b)The x in [0,1] with betainc(x,a,b) = p -- base MATLAB's inverse incomplete beta, and the engine every beta, F and Student t quantile on this console is built from. Bracketed Newton run to machine precision, so what agrees with MATLAB is the ROOT and not a path to it
hypothypot(a,b)sqrt(a^2 + b^2) without intermediate overflow (a scalar broadcasts)
atan2atan2(y,x)Four-quadrant arctangent of y/x, in (-pi, pi]
modmod(a,m)Remainder after division, sign following the DIVISOR; mod(a,0) is a
remrem(a,m)Remainder after division, sign following the DIVIDEND; rem(a,0) is NaN
gcdgcd(a,b)Greatest common divisor of integer-valued a and b, elementwise; [g, c, d] = gcd(a, b) is Bezout's identity, a*c + b*d == g. ⚠ On SYMBOLIC values (T4.18) the same name is the gcd of two exact rationals or two polynomials, and it keeps the CONTENT: gcd(2*x^2 - 2, 4*x + 4) is 2*x + 2, not x + 1
lcmlcm(a,b)Least common multiple; both arguments must be POSITIVE integers. ⚠ On SYMBOLIC values (T4.18) it is (a/gcd)*b taken positive, over rationals and polynomials too: lcm(2*x, 3*x) is 6*x
factorialfactorial(n)n! per element (n a non-negative integer)
nchooseknchoosek(n,k)Binomial coefficient for scalar n; every k-combination as rows for a vector
nthrootnthroot(x,n)Real n-th root; a negative x needs an odd integer n
realsqrtrealsqrt(A)Square root, refusing a negative entry instead of going complex
reallogreallog(A)Natural logarithm, refusing a negative entry instead of going complex
realpowrealpow(a,b)Power, refusing a negative base with a fractional exponent
gtgt(A,B)Element-wise A > B (the function form of >)
ltlt(A,B)Element-wise A < B (the function form of <)
gege(A,B)Element-wise A >= B (the function form of >=)
lele(A,B)Element-wise A <= B (the function form of <=)
eqeq(A,B)Element-wise A == B, exactly (the function form of ==)
nene(A,B)Element-wise A ~= B, exactly (the function form of ~=)
randrand / rand(n) / rand(m,n) / rand([m n])Uniform random in [0,1): a scalar, n x n, or m x n
randnrandn / randn(n) / randn(m,n)Standard normal random, same size forms as rand
randirandi(imax[,m[,n]]) / randi([a b],...)Whole numbers drawn uniformly from 1..imax, or from the closed range [a b]
randpermrandperm(n[,k])k values drawn from 1..n without replacement, as a row; k defaults to n (the full permutation)
rngrng / rng(seed) / rng("default") / rng("shuffle")Seed the one generator behind rand/randn/randi/randperm; answers the seed that was in force (MATLAB answers a settings struct, which the console has no kind for)
ticticStart the stopwatch; answers 0, because MATLAB's tic yields no value and every console expression must yield one
toctocSeconds since the last tic -- MATLAB's t = toc
sumsum(A[,dim]) / sum(A,"all") / sum(A,"omitnan")Sum down each column (or along dim), of every element with "all"; a NaN propagates unless "omitnan" is asked for
meanmean(A[,dim]) / mean(A,"all")Mean down each column (or along dim), or of every element with "all"; same NaN rule as sum
maxmax(A[,[],dim]) / max(A,B) / [m,i] = max(A)Largest down each column (or along dim, or of every element with "all"); max(A,B) is element-wise; the second output is where it was found. A NaN never wins
minmin(A[,[],dim]) / min(A,B) / [m,i] = min(A)Smallest, in every form max takes
normnorm(A[,p])Matrix norm for p = 1, 2, Inf or "fro"; for a VECTOR any p > 0 and both infinities. norm(A) is p = 2. norm(sys) and norm(sys, 2) are a MODEL's H2 norm (T1.33)
vecnormvecnorm(A[,p[,dim]])p-norm of each column (dim 1) or row (dim 2); defaults are p = 2 and the first non-singleton dimension
normfronormfro(A)Frobenius norm (extra: norm(A, "fro"))
normrmsnormrms(A)RMS norm
norm1norm1(A)1-norm (max absolute column sum)
norm2norm2(A)2-norm (largest singular value, power iteration)
norminfnorminf(A)Infinity norm (max absolute row sum)
nucnormnucnorm(A)Nuclear norm (sum of singular values)
sumrowssumrows(A)Sum of each row, as a column vector
sumcolssumcols(A)Sum of each column, as a row vector
meanrowsmeanrows(A)Mean of each row, as a column vector
meancolsmeancols(A)Mean of each column, as a row vector
maxrowsmaxrows(A)Largest element of each row, as a column vector
maxcolsmaxcols(A)Largest element of each column, as a row vector
minrowsminrows(A)Smallest element of each row, as a column vector
mincolsmincols(A)Smallest element of each column, as a row vector
cumsumcumsum(A[,dim])Running sum along dim (1 = down the columns, 2 = along the rows); default is the first dimension with more than one entry
cumprodcumprod(A[,dim])Running product along dim; same default as cumsum
cummaxcummax(A[,dim])Running largest-so-far along dim; a NaN reports the running maximum rather than spreading
cummincummin(A[,dim])Running smallest-so-far along dim; a NaN reports the running minimum rather than spreading
reshapereshape(A,r,c) / reshape(A,[r c])Reshape A into r x c, reading and writing down the COLUMNS (MATLAB's element order)
flipudflipud(A)Flip A vertically (reverse row order)
fliplrfliplr(A)Flip A horizontally (reverse column order)
flipflip(A[,dim])Reverse A along dim (1 = rows, 2 = columns); default is the first dimension with more than one entry
isemptyisempty(A)1 when A has no entries -- always 0 until the console has an empty matrix
isscalarisscalar(A)1 when A is 1 x 1
isvectorisvector(A)1 when A is 1 x n or n x 1
isrowisrow(A)1 when A is 1 x n
iscolumniscolumn(A)1 when A is n x 1
ismatrixismatrix(A)1 when A is 2-D -- true of everything the console holds
isdiagisdiag(A)1 when every off-diagonal entry is exactly zero
istriuistriu(A)1 when every entry below the main diagonal is exactly zero
istrilistril(A)1 when every entry above the main diagonal is exactly zero
isbandedisbanded(A,lo,up)1 when every non-zero entry lies within lo bands below and up above the main diagonal
linsolvelinsolve(A,b)Solve A*x = b -- MATLAB's name for solve() and the backslash operator
lsqnonneglsqnonneg(C,d)Least-squares solution of C*x = d over x >= 0, by the Lawson-Hanson active-set algorithm
optimoptionsoptimoptions(solver[,"Name",value,...])An option set for one Optimization Toolbox solver, named as a string or a handle: optimoptions("fminunc","StepTolerance",1e-9). optimoptions(opts,"Name",value) updates one. The VALUE is the call's own canonical text, the shape odeset answers, so it stores and crosses the bridge as a string. Legacy names map in (TolX, TolFun, MaxIter, MaxFunEvals, GradObj); a name MATLAB does not have for that solver gets MATLAB's own "is not an option for FMINUNC", and one this console's algorithm cannot honour is refused by name when the solver reads it. fminsearch, fminbnd, fzero and lsqnonneg take optimset instead, which is MATLAB's split too
optimsetoptimset([oldopts,]"Name",value,...)The older, solver-agnostic option set: optimset("TolX",1e-10,"MaxIter",50), and optimset(oldopts,...) to extend one. Its 55 names are MATLAB's own list, kept in their legacy spelling because that is the spelling optimget answers them under. This is the set fminsearch, fminbnd and fzero read
lsqminnormlsqminnorm(A,b)Of all the least-squares solutions of A*x = b, the one of smallest norm
condestcondest(A) / [c,v] = condest(A)An ESTIMATE of cond(A,1) -- norm(A,1) times an estimate of norm(inv(A),1) by Hager's iteration, so no inverse is formed. v is a vector on which A is nearly singular
normestnormest(A[,tol]) / [nrm,cnt] = normest(...)An ESTIMATE of the 2-norm of A by power iteration to a relative tolerance (default 1e-6), and the number of iterations it took. norm(A,2) is the exact one
cholupdatecholupdate(R,x[,"+"|"-"]) / [R1,p] = cholupdate(...)The upper Cholesky factor of A + x*x', or of A - x*x' for "-", from the factor R of A. p is 0 on success and otherwise the step at which the downdated matrix stopped being positive definite
qrupdate[Q1,R1] = qrupdate(Q,R,u,v)The QR factors of A + u*v' from the factors of A, by rotating them rather than factorizing again
qrinsert[Q1,R1] = qrinsert(Q,R,j,x[,"col"|"row"])The QR factors of A with the column (or row) x inserted before index j
qrdelete[Q1,R1] = qrdelete(Q,R,j[,"col"|"row"])The QR factors of A with column (or row) j deleted
cdf2rdf[V1,D1] = cdf2rdf(V,D)The eigen-decomposition of a real matrix rewritten REAL: conjugate eigenvalue pairs become 2x2 blocks on D's diagonal. The inverse of rsf2csf's direction
rsf2csf[U1,T1] = rsf2csf(U,T)The real Schur pair from schur(A) rewritten COMPLEX: the 2x2 blocks become eigenvalues on T's diagonal
gsvdgsvd(A,B) / [U,V,X,C,S] = gsvd(A,B[,"econ"])The generalized singular values of the pair (A, B) as a non-decreasing column, or the decomposition A = U*C*X', B = V*S*X' with C'*C + S'*S = I. gsvd.m transcribed; U, V and X may differ from MATLAB's by the sign of a column, C and S do not
polyeigpolyeig(A0,A1,...,Ap) / [X,e] = polyeig(...)The eigenvalues (and eigenvectors) of the polynomial problem (A0 + lambda*A1 + ... + lambda^p*Ap)*x = 0, by MATLAB's companion linearization and the QZ algorithm
lscovlscov(A,b[,w])Ordinary or weighted least squares; a rank-deficient A is refused, not answered with a basic solution
rot90rot90(A[,k])Rotate A a quarter turn counter-clockwise, k times (k may be negative)
circshiftcircshift(A,k[,dim])Shift A circularly by k along dim; circshift(A,[r c]) shifts both
triutriu(A[,k])Upper triangle of A on and above the k-th diagonal (k defaults to 0)
triltril(A[,k])Lower triangle of A on and below the k-th diagonal (k defaults to 0)
blkdiagblkdiag(A,B[,C])Block-diagonal matrix built from the operands, zeros elsewhere
diffdiff(A[,n[,dim]])n-th order difference along dim; refuses when the order would empty the dimension. ⚠ ON A SYMBOLIC VALUE THE SAME NAME IS THE DERIVATIVE (T4.4) -- diff(f), diff(f, x), diff(f, x, n) and the mixed diff(f, x, y) -- which is MATLAB's own overload rather than a second name
numelnumel(A)Number of entries in A
lengthlength(A)Longest dimension of A (0 when A is empty)
ndimsndims(A)Number of dimensions of A -- 2 for every matrix the console holds
nnznnz(A)Count of non-zero entries in A
nonzerosnonzeros(A)Non-zero entries of A as a column, in column-major order
sortsort(A[,dim[,mode]])Sort along dim (default: the first dimension with more than one entry); mode is "ascend" or "descend"
sortrowssortrows(A[,cols])Order whole rows by the given 1-based columns, a negative column sorting descending on it
uniqueunique(A[,mode])Sorted distinct values; mode is "rows" or "stable" (first-appearance order)
findfind(A[,n[,mode]])1-based column-major indices of the non-zero entries; mode is "first" or "last"
sub2indsub2ind([r c],i,j)Column-major linear index of a subscript pair, 1-based
ind2subind2sub([r c],k)MATLAB's one-output form: the index unchanged (the useful [r,c] form needs multiple outputs)
ismemberismember(A,S[,"rows"])1 where A's entry (or row) appears in S
unionunion(A,B[,mode])Distinct values in either, sorted; mode is "rows" or "stable"
intersectintersect(A,B[,mode])Distinct values in both, sorted
setdiffsetdiff(A,B[,mode])Distinct values of A that are not in B
setxorsetxor(A,B[,mode])Distinct values in exactly one of the two
repmatrepmat(A,n) / repmat(A,[m n]) / repmat(A,r,c)Tile A: n x n times, or r times vertically and c horizontally
eyeeye(n) / eye(m,n) / eye([m n])Identity: ones on the main diagonal, zeros elsewhere
magicmagic(n)MATLAB's n x n magic square (rows, columns and both diagonals sum alike; n = 2 is MATLAB's degenerate square)
coloncolon(a,b) / colon(a,s,b)Row vector a, a+s, ... up to b -- the function form of a range; the last entry is exactly b when it lands on it
squeezesqueeze(A)Drop the dimensions of extent 1 -- the identity on a 2-D matrix, which is all this console holds
permutepermute(A,[2 1])Reorder the dimensions; over two dimensions [2 1] is the transpose and [1 2] the identity
ipermuteipermute(A,[2 1])Inverse of permute; over two dimensions it is permute itself
prodprod(A[,dim]) / prod(A,"all")Product down each column (or along dim), or of every entry with "all"
onesones(n) / ones(m,n) / ones([m n])Matrix of ones: n x n, or m x n
accumarrayaccumarray(subs,val)Sum val into the entries named by subs -- an n x 1 column of row subscripts, or an n x 2 of [row, col]; unvisited entries are zero
histcountshistcounts(x) / histcounts(x,n) / histcounts(x,edges)Count x into bins: MATLAB's automatic rule, n bins of its choosing, or the given edges; bin i is [e(i), e(i+1)) and the last bin is closed
trapztrapz(y) / trapz(x,y) / trapz(y,dim) / trapz(x,y,dim)Trapezoidal integral along dim, over unit spacing or the grid x
cumtrapzcumtrapz(y) / cumtrapz(x,y[,dim])Running trapezoidal integral, starting at 0 and keeping the shape of y
fevalfeval(f,a1,...)Call the function handle f (or the function named by a character vector) with the arguments given
func2strfunc2str(f)The source text of a function handle. The console answers it AS WRITTEN, where MATLAB reprints it from its own parse
str2funcstr2func(s)The function handle a character vector spells. A free name in an anonymous body is a function, never a variable of this workspace -- str2func captures nothing, as MATLAB's does not
arrayfunarrayfun(f,A,...)f applied to every element, answering an array of the same shape. "UniformOutput", false needs cell arrays and is refused (C12.1)
fzerofzero(f,x0) / fzero(f,[a b])A zero of f: searched for outward from x0, or solved inside a bracket whose ends differ in sign. Brent's method, MATLAB's own iteration
fminbndfminbnd(f,a,b)The minimiser of f inside [a,b], by golden section with parabolic interpolation
fminsearchfminsearch(f,x0) / [x,fval] = fminsearch(f,x0)The minimiser of f found by the Nelder-Mead simplex from x0, whose SHAPE the search keeps
fminconfmincon(fun,x0[,A,b,Aeq,beq,lb,ub,nonlcon,options]) / [x,fval,exitflag] = fmincon(...)The minimiser of fun from x0 subject to A*x <= b, Aeq*x = beq, lb <= x <= ub and a nonlcon handle answering [c, ceq] with c <= 0 and ceq = 0 (Optimization Toolbox). Every argument after x0 is optional and an absent one is written [] -- fmincon(fun,x0,[],[],[],[],lb,ub) is a bounds-only problem. A sequential quadratic programme: Powell-damped BFGS on the Lagrangian, the linearised subproblem solved by the same active set quadprog runs, an L1 merit line search. "Algorithm" is honoured for "sqp", which is what that describes; MATLAB's default interior-point and its active-set are different iterations that answer a different point, and on MATLAB's own Rosenbrock-under-a-line example its active-set finds a DIFFERENT local minimum (fval 3.99 against 0.2489)
integralintegral(f,a,b[,"AbsTol",t][,"RelTol",t])The integral of f from a to b by adaptive Gauss-Kronrod quadrature; either limit may be infinite
quadgkquadgk(f,a,b[,"AbsTol",t][,"RelTol",t][,"Waypoints",w][,"MaxIntervalCount",m]) / [q,errbnd] = quadgk(...)The same Gauss-Kronrod (7,15) rule as integral under MATLAB's other loop for it, with waypoints through an integrand's kinks and an error bound as the second output
integral2integral2(f,xmin,xmax,ymin,ymax[,"AbsTol",t][,"RelTol",t][,"Method",m])The double integral of f(x,y); the y limits are numbers or functions of x. "tiled" (finite limits) or "iterated" (an infinite one), which is what "auto" picks between
integral3integral3(f,xmin,xmax,ymin,ymax,zmin,zmax[,"AbsTol",t][,"RelTol",t][,"Method",m])The triple integral of f(x,y,z); the y limits are functions of x and the z limits functions of x and y. An integral over x of an integral2 in (y,z)
odesetodeset("Name",value,...)An ode45 options value: "RelTol", "AbsTol", "MaxStep", "InitialStep", "Refine". MATLAB's is a struct and this console has none, so it answers the odeset call text -- which is what crosses the bridge
odegetodeget(opts,"Name"[,default])One option read back out of an odeset value; [] when it was never set, or the default given as a third argument
quadquad(f,a,b[,tol])Adaptive Simpson with one Romberg step -- MATLAB's legacy rule, kept because a .m may call it; integral(f,a,b) is the one to write
quadlquadl(f,a,b[,tol])Adaptive Lobatto with a Kronrod refinement -- MATLAB's other legacy rule, kept for the same reason; integral(f,a,b) is the one to write
orthorth(A[,tol])Orthonormal basis for the range of A, as columns -- the leading rank(A) left singular vectors
linspacelinspace(a,b[,n])n evenly spaced points from a to b, as a ROW vector; n defaults to 100
meshgridmeshgrid(x[,y])Grid coordinates over x and y: [X, Y] = meshgrid(x, y) is numel(y) BY numel(x), x running along each row; meshgrid(x) grids x against itself
ndgridndgrid(x[,y])meshgrid transposed -- [A, B] = ndgrid(x, y) is numel(x) by numel(y), x running down each column; ndgrid(x) with one output is x as a column
logspacelogspace(a,b[,n])n points spaced logarithmically from 10^a to 10^b, as a ROW; n defaults to 50, and an upper exponent of exactly pi sweeps to pi itself
convconv(u,v[,shape])Convolution of two vectors (polynomial multiplication); shape is "full" (default), "same" or "valid"
conv2conv2(A,B[,shape])Two-dimensional convolution; same three shapes
filter2filter2(h,A[,shape])Correlate A with kernel h -- conv2 with h turned a half-turn; shape defaults to "same"
filterfilter(b,a,x[,zi[,dim]])Run the rational difference equation b/a over x in Direct Form II Transposed (a(1) must be non-zero and divides through). Columns by default, a row vector along itself, dim to choose; [y,zf] = filter(...) also answers the state it stopped in, always max(numel(a),numel(b))-1 rows by one column per signal
polyvalpolyval(p,x)Evaluate the polynomial p at every entry of x
polyvalmpolyvalm(p,A)Evaluate p IN the square matrix A (x^2 is A*A, and the constant term is that multiple of the identity)
polyintpolyint(p[,k])Coefficients of the integral of p, with constant of integration k (default 0)
polyderpolyder(p) / polyder(a,b)Coefficients of the derivative of p, or of the PRODUCT a*b; [q, d] = polyder(b, a) is the quotient rule, d(b/a) = q/d
deconvdeconv(b,a)Polynomial long division: the quotient of b by a, and [q, r] = deconv(b, a) the remainder too, as long as b
splinespline(x,y,xq)Not-a-knot cubic spline through (x,y), evaluated at xq (extrapolates by continuing the end cubic)
pchippchip(x,y,xq)Shape-preserving cubic through (x,y) at xq -- never overshoots between samples
medianmedian(A[,dim][,"omitnan"])Median down each column; a NaN makes the answer NaN unless omitted
stdstd(A[,w][,dim])Standard deviation; w is 0 (default, N-1), 1 (N), or a vector of weights
varvar(A[,w][,dim])Variance; w is 0 (default, N-1), 1 (N), or a vector of weights
corrcorr(X[,Y][,name,value])MATLAB's correlation: corr(X) is the pairwise matrix between X's columns (the one form that IS corrcoef(X)), corr(X,Y) is the correlations BETWEEN two sets of columns -- not corrcoef(x,y)'s 2 x 2 joint matrix. "Type" is "pearson" (default), "spearman" (Pearson of the tied ranks) or "kendall" (tau-b); "Rows" is "all", "complete" or "pairwise"; [rho,p] adds the t-based p-value, for Pearson only
partialcorrpartialcorr(X[,Y],Z[,name,value])Correlation of what is left of X (and Y) after regressing each column on [1 Z] -- the association that survives controlling for Z. "Type" is "pearson" or "spearman"; [rho,p] adds the t-based p-value at n - rank(Z) - 2 degrees of freedom
rotatefactorsrotatefactors(A[,name,value])Rotate a loading matrix: [B,T] with B = A*T. "Method" is "varimax" (default), "quartimax", "equamax", "parsimax", "orthomax" (with "Coeff"), "promax" (with "Power", default 4) or "procrustes" (with "Target" and "Type"). "Normalize" is Kaiser's row normalisation, on by default; "Reltol" and "Maxit" bound the iteration. ⚠ A that is ALREADY rotated makes rotatefactors.m restart from a RANDOM orthogonal matrix; that input refuses here rather than answering off MATLAB's generator
corrcoefcorrcoef(A) / corrcoef(x,y)Correlation matrix of A's columns, or the 2x2 correlation of two vectors
rescalerescale(A[,l,u])Scale the whole array onto [l,u] (default [0,1]) from its own min and max
movmeanmovmean(A,k[,dim])Moving average over a k-wide window
movsummovsum(A,k[,dim])Moving sum over a k-wide window
movmedianmovmedian(A,k[,dim])Moving median over a k-wide window
movmaxmovmax(A,k[,dim])Moving maximum over a k-wide window
movminmovmin(A,k[,dim])Moving minimum over a k-wide window
movstdmovstd(A,k[,w])Moving standard deviation; w is 0 (default, N-1) or 1 (N)
movvarmovvar(A,k[,w])Moving variance; w is 0 (default, N-1) or 1 (N)
sizesize(A[,dim])Size of A as [rows cols]; [m, n] = size(A) splits it
boundsbounds(A[,"all"])Column-wise minimum; [lo, hi] = bounds(A) answers both
modemode(A[,dim])Most frequent value down each column, ties going to the smallest
isnanisnan(A)1 where an entry is NaN
isinfisinf(A)1 where an entry is +Inf or -Inf
isfiniteisfinite(A)1 where an entry is neither infinite nor NaN
anyany(A[,dim])1 where a column holds a non-zero entry; NaN does not count
allall(A[,dim])1 where every entry of a column is non-zero; NaN is skipped
andand(a,b)Element-wise logical AND (the function form of &); a scalar operand broadcasts
oror(a,b)Element-wise logical OR (the function form of \|); a scalar operand broadcasts
xorxor(a,b)Element-wise exclusive OR; a scalar operand broadcasts
notnot(a)1 where an entry is zero, 0 elsewhere (the function form of ~)
isequalisequal(A,B,...)1 when every argument has the same shape and entries (NaN is never equal)
isequalnisequaln(A,B,...)isequal, but NaN counts as equal to NaN
issortedissorted(A[,"rows"])1 when each column is non-decreasing (NaN sorts last)
primesprimes(n)Every prime up to n, as a row vector
isprimeisprime(X)1 where an entry is prime; the entries must be non-negative integers
classclass(x)The class name: "double" for a matrix, "char" for a string, and the console's own type name for a polynomial, tf, ss or timeseries
isnumericisnumeric(x)1 when x is a matrix -- the console's only numeric kind (there are no integer or single types)
isfloatisfloat(x)1 when x is a matrix; every console number is a double
isintegerisinteger(x)Always 0: the console has no integer types
ischarischar(x)1 when x is a string, which crosses to MATLAB as a char array
islogicalislogical(x)1 when x is a logical array -- what a comparison, a connective, any/all and every is* question answers (C9.4)
logicallogical(A)A as a logical array: every non-zero entry becomes 1. A NaN is refused rather than converted, as in MATLAB
isstringisstring(x)Always 0: the console has no MATLAB string class, only char
iscelliscell(x)Always 0: the console has no cell arrays
isstructisstruct(x)Always 0: the console has no structs
isaisa(x,"class")1 when class(x) is that name, or when x is a matrix and the name is "numeric" or "float"
factorfactor(n)Prime factors of the scalar n, ascending with repeats. ⚠ On a SYMBOLIC polynomial the same name factors it over the rationals (T4.2): factor(x^2 - 1) is [x - 1, x + 1], and factor(x^2 - 2) stays whole on both sides because its roots are not rational
unitunit(v)Unit vector v / \|\|v\|\| -- the console's own, which held the name normalize until C6.8
normalizenormalize(A[,dim][,method[,arg]])MATLAB's normalize: z-score down each column by default; method is "zscore", "center", "scale", "range" (arg [lo hi]) or "norm" (arg p). NaN is omitted from the statistics and kept in place
vecanglevecangle(a,b)Angle between two vectors, in radians (MATLAB's angle() is complex phase, which angle(z) now answers)
sylvestersylvester(A,B,C)Solves A*X + X*B = C
fftshiftfftshift(A[,dim])Swap the halves of each dimension so the zero-frequency term sits in the centre
ifftshiftifftshift(A[,dim])Undo fftshift; the two differ only for an odd length
fftfft(x[,n[,dim]])Discrete Fourier transform, down the columns by default; n pads or truncates
fft2fft2(A)Two-dimensional DFT: fft along the columns and then along the rows
ifft2ifft2(A)Inverse of fft2
realreal(z)Real part
imagimag(z)Imaginary part (0 for a real argument)
conjconj(z)Complex conjugate
angleangle(z)Phase in radians, atan2(imag, real) -- 0 for a positive real, pi for a negative one
complexcomplex(a[,b])Build a complex value that stays complex: isreal(complex(3,0)) is 0, unlike 3 + 0i
isrealisreal(x)1 when the value is stored as real -- a question about the STORAGE, so isreal(complex(3,0)) is 0
iscomplexiscomplex(x)The negation of isreal
ifftifft(X[,n]) / ifft(X,"symmetric")Inverse DFT; a conjugate-symmetric spectrum answers a REAL signal, as MATLAB's does
fftmagfftmag(x)Magnitude of fft(x)
fftphasefftphase(x)Phase (radians) of fft(x)
interp1interp1(x,v,xq[,method[,extrap]])Interpolate v=f(x) at xq. method is "linear" (default), "nearest", "next", "previous", "spline" or "pchip"; outside [min(x),max(x)] the answer is NaN unless the method is a cubic, "extrap" is asked for, or a scalar fill is given
interp2interp2(X,Y,V,Xq,Yq[,method[,extrap]])Interpolate V=f(X,Y) on a plaid grid at the query points, which broadcast against one another. method is "linear" (default), "nearest", "next" or "spline"; outside the grid the answer is NaN unless the method is "spline", "extrap" is asked for, or a scalar fill is given
polyfitpolyfit(x,y,n)Coefficients (a row, highest power first) of the degree-n polynomial that least-squares fits the samples; n must be below the number of points
quat2rotmquat2rotm(q)Quaternion to 3x3 rotation matrix
rotm2quatrotm2quat(R)3x3 rotation matrix to quaternion
tfesttfest(u,y,Ts,np[,nz][,ioDelay][,"Ts",Ts][,"Feedthrough",true])MATLAB's tfest: np poles and nz zeros fitted to the record, in T6.1's input-first order with the RECORD's sample time third. The answer is CONTINUOUS unless the "Ts" name-value is given -- that is MATLAB's own default and the third argument does not change it. nz defaults to np - 1. The continuous fit is srivc-initialised and refined by a structured state-space prediction-error search whose INITIAL STATE is estimated too; the discrete one IS oe(u, y, Ts, [nz, np, 1]) -- [nz+1, np, 0] when nz is 0 or Feedthrough is on -- measured bit-identical. nz > np is legal discrete and an error continuous, and a nonzero ioDelay is answered only by a discrete estimate, because a tf here has no delay property (T1.32). MATLAB's ic second output is an object (Z3); its warnings for a mismatched "Ts" and for "Feedthrough" on a continuous fit have no channel here, and the ANSWER matches either way
n4sidn4sid(u,y,Ts,nx[,name,value,...])MATLAB's n4sid: a state-space model of order nx estimated from the record by the SUBSPACE method, answered as a discrete ss. [sys, x0] = n4sid(...) also answers the initial state the fit used. The name-value options are MATLAB's own -- "N4Weight" ("auto", "CVA", "MOESP"; "auto" IS "CVA"), "N4Horizon" ([r s1 s2], automatic when it is not given), "DisturbanceModel" ("estimate" or "none") and "Feedthrough" (true or false). nx = 0 answers the static gain. ⚠ Ts stamps the model and does not scale the estimate, which is written in lags. ⚠ A, B, C and x0 agree with MATLAB's up to the SIGN of each state, which an SVD does not fix; tfdata, pole and dcgain do not move with it
symsym(x[,flag])A SYMBOLIC value. sym(0.1) is 1/10, not 0.1: MATLAB's default conversion RECOGNISES a number -- a short rational, a rational multiple of pi (sym(pi/4) is pi/4), or a square root of one (sym(sqrt(2)) is 2^(1/2)) -- and falls back to the exact binary value of the double when nothing short reproduces it. sym('x') declares a variable; sym(A) converts a matrix elementwise. The flag is 'r' (the default), 'f' (the exact binary value) or 'd' (a decimal); 'e' is refused, since its answer carries an eps term and an assumption set this console has no row for
symssyms x y zDeclare symbolic variables -- a STATEMENT, so it prints nothing, and syms x is exactly x = sym('x'). syms x real and syms f(x) are refused by name: an assumption and a symbolic function change what the symbol means
taylortaylor(f[,x[,a]][,"Order",n])The Taylor series about a (0 by default). ⚠ 'Order' is an ORDER and not a degree: the default 6 stops at x^5, which is MATLAB's convention too (T4.6)
solvesolve(eqn[,x]) / [x,y] = solve(eq1,eq2,x,y)Solve a symbolic equation. ⚠ The same name on two MATRICES is this console's own solve(A, b), which is A \\ b -- the kinds tell them apart. Polynomials come out exactly (rational roots, radicals for a quadratic, and MATLAB's root(z^5 - z + 1, z, k) notation for an irreducible higher one, which is what MATLAB writes for a general cubic too); x^n = c comes out in radicals; a rational equation is solved through its numerator; and an elementary function is peeled off one at a time. A system is the multi-output form and must be square and LINEAR (T4.8)
diracdirac(x[,n])The delta: Inf at 0 and 0 everywhere else. dirac(n, x) is its n-th derivative, which is what diff answers with. int(dirac(x)) is heaviside(x) (T4.16)
del2del2(f[,hx[,hy]])MATLAB's discrete Laplacian, divided by 2*ndims -- del2.m's own scaling, so del2([1 4 9 16]) is 0.5 and not 1. The ends are a linear extrapolation of the interior second differences
divergencedivergence([X,Y,]U,V)MATLAB's 2-D divergence of a vector field: d(U)/dx + d(V)/dy, each a numeric gradient. The grid is optional and only X's first row and Y's first column are read
curlcurl([X,Y,]U,V)MATLAB's 2-D curl. ONE output is the ANGULAR VELOCITY -- half the curl -- and [curlz, cav] = curl(...) answers the curl first, which is MATLAB's own rule and not a shorthand
detrenddetrend(x[,n])Subtract the least-squares polynomial of degree n (default 1) from each column. n = 0 is MATLAB's 'constant' and is the mean; 'constant' and 'linear' are accepted as words
xcorrxcorr(x[,y][,maxlag][,scale])Cross-correlation of two vectors, or the autocorrelation of one, over 2*maxlag+1 lags with lag 0 in the middle. scale is 'none', 'biased', 'unbiased' or 'coeff'. [c, lags] = xcorr(...) reports the lags
xcovxcov(x[,y][,maxlag][,scale])Cross-covariance: xcorr of the MEAN-REMOVED signals, same arguments and same scales. [c, lags] = xcov(...) reports the lags
prctileprctile(x,p[,dim])Percentiles of x, p in PERCENT. MATLAB's rule: the i-th of n sorted samples sits at (i-0.5)/n, and the ends CLAMP rather than extrapolate -- not R's type-7 rule, which differs everywhere but the median
quantilequantile(x,p[,dim])Quantiles of x, p in [0,1] -- prctile with p*100. A whole scalar p greater than 1 means that many evenly spaced quantiles, (1:p)/(p+1)
iqriqr(x[,dim])Interquartile range: the 75th percentile less the 25th, through prctile's rule
rangerange(x[,dim])Largest less smallest. max(A) - min(A) is the core spelling of the same answer
madmad(x[,flag[,dim]])Absolute deviation about the centre. mad(x) and mad(x,0) are the MEAN absolute deviation; mad(x,1) is the MEDIAN one -- the more famous statistic is the one you ask for
zscorezscore(x[,flag[,dim]])Standardised score, (x-mean)/sd. flag 0 (default) divides by N-1, flag 1 by N. A zero deviation is replaced by 1, so a constant vector answers zeros rather than NaN. [z,mu,sigma] adds the two numbers used
skewnessskewness(x[,flag[,dim]])Third standardised central moment. flag 1 (the DEFAULT, unlike std) is biased; flag 0 corrects, and is NaN below 3 samples
kurtosiskurtosis(x[,flag[,dim]])Fourth standardised central moment, 3 for a normal sample. flag 1 (the DEFAULT) is biased; flag 0 corrects, and is NaN below 4 samples
momentmoment(x,order[,dim])The central moment of that order, always about the biased mean. Order 1 is exactly 0 by definition
knnsearchknnsearch(X,Y[,"K",k][,"Distance",metric][,"P",p])The k nearest rows of X to each row of Y, nearest first: [idx,d] = knnsearch(...) answers a 1-based index matrix and the matching distances, one row per query point. TIES GO TO THE SMALLER INDEX, which is MATLAB's answer though its documentation promises only "one of them". "IncludeTies" would answer a cell and is refused
normcdfnormcdf(x[,mu[,sigma]][,"upper"])The normal cumulative probability at x. A trailing "upper" is the upper tail computed EXACTLY -- it negates z and takes the same erfc -- where 1 - normcdf(x) has run out of digits: normcdf(-6,"upper") is 0.999999999 and 1 - normcdf(-6) is 1.
mlemle(x[,"Distribution",name][,"Alpha",a][,"ntrials",n][,"mu",m])[phat, pci] = the maximum-likelihood fit of a NAMED distribution. mle is a dispatch, not an estimator: it calls expfit, poissfit, raylfit, gamfit, wblfit, evfit, unifit, lognfit, normfit or binofit and hands back their numbers, plus four closed forms of its own (bernoulli, geometric, discrete uniform, half normal) that have no *fit function anywhere in MATLAB. ⚠ It disagrees with the fit it called in exactly one place: the normal's and the lognormal's second parameter is the MAXIMUM-LIKELIHOOD deviation (divided by n) where normfit and lognfit answer the unbiased one (divided by n - 1) -- 6.5% apart at n = 8 -- and the INTERVAL is the unbiased one's, uncorrected. mle(x) with no name is the normal. The name is a unique case-insensitive prefix of one of eighteen, so "nor" is the normal and "n" is ambiguous; "ev", "wbl", "unid", "hn", "gev", "gp" and "nbin" are short codes. beta, negative binomial and the two generalized families are refused for their fits' reason
cdfcdf(name, x[, a, b, c][, "upper"])The cumulative distribution of a named distribution; "upper" is the exact upper tail. The same zero-fill and the same prefix rule as pdf
icdficdf(name, p[, a, b, c, d])The quantile of a named distribution -- the inverse of cdf. The same zero-fill and prefix rule
robustfitrobustfit(X,y[,wfun[,tune[,const]]])b = the robust linear fit by iteratively reweighted least squares. ⚠ It ADDS a constant column unless the fifth argument is "off" -- the opposite of regress, which never adds one. The nine weight functions are "andrews", "bisquare" (the default), "cauchy", "fair", "huber", "logistic", "ols", "talwar" and "welsch", each with the tuning constant that makes it 95% as efficient as least squares on normal data -- so changing the constant changes what the estimator is. The stats struct MATLAB returns second is refused by name
glmfitglmfit(X,y,distr[,"link",L][,"constant","on"|"off"])b = the generalized linear fit, also by iteratively reweighted least squares. Distributions: "normal", "binomial", "poisson", "gamma", "inverse gaussian". The CANONICAL link is a property of the distribution -- identity, logit, log, reciprocal and the -2 power respectively -- and a link may be named or given as a power, where 0 means log. A binomial's trial counts arrive as an n by 2 y of [successes trials]; glmfit has no "size" option
glmvalglmval(b,X,link[,"size",N][,"constant","on"|"off"])yhat = the inverse link of X*b, times N for a binomial. The link may be a name or a NUMBER, and the number is a power link -- 0 meaning the log link, the one exponent that is not its own
nlpredcinlpredci(modelfun,X,beta,resid,"covar"|"jacobian",M[,"alpha",a][,"predopt","curve"|"observation"][,"simopt","on"|"off"])[ypred, delta] = the prediction and its half-width by the delta method. "observation" adds the error variance to the curve's uncertainty; "simopt" widens t to Scheffe. ⚠ Its finite-difference step is not nlinfit's -- a zero coefficient falls back to sqrt(norm(beta)) here and norm(beta) there. Simultaneous intervals on new OBSERVATIONS are refused: their Scheffe parameter comes from an unpublished SVD rule
stepwisefitstepwisefit(X,y[,"penter",a][,"premove",b][,"scale","on"|"off"])[b, se, pval, inmodel] = the forward/backward stepwise search from the empty model: the column with the smallest p enters while that p is below penter (0.05), otherwise the one with the largest p leaves while it is above premove (0.10). ⚠ The two p-values sit on DIFFERENT degrees of freedom -- dfe inside the model, dfe - 1 outside it -- and "scale" defaults to OFF, so the coefficients come back on the data's own scale though every decision was taken on the standardised one
lassolasso(X,y[,"Alpha"|"Lambda"|"NumLambda"|"LambdaRatio"|"DFmax"|"Standardize"|"Intercept"|"RelTol"|"MaxIter"|"Weights"|"UseCovariance",value ...])B = one column of elastic-net coefficients per penalty, on the ORIGINAL scale of X and in ASCENDING lambda order. With no "Lambda" it fits 100 penalties geometric from the smallest one that zeroes every coefficient down to 1e-4 of it, and STOPS EARLY when a fit exceeds "DFmax" or its error falls below a thousandth of the null model's -- so the answer can have fewer than 100 columns. ⚠ It standardizes with the POPULATION deviation, std(X,1), where ridge uses the sample one. The FitInfo struct is refused; "CV" and "MCReps" are refused because their folds are random even in MATLAB
smoothsmooth([x,]y[,span][,method[,degree]])c = the series smoothed, always as a COLUMN. Six methods: "moving" (a running mean), "lowess"/"loess" (a local line or parabola, tricube-weighted by distance), their robust "rlowess"/"rloess" spellings (five reweighting passes), and "sgolay" (a local polynomial of degree, default 2, with no distance weighting). ⚠ THE ENDS SHRINK RATHER THAN PAD: the first answer is y(1) itself and the second the mean of the first three -- movmean's "Endpoints", "shrink", not its default. ⚠ An EVEN span is the odd one BELOW it, and a span below 1 is a FRACTION of the data. ⚠ With no method the choice depends on the DATA: "moving" for evenly spaced x, "lowess" otherwise. The x argument is read by TYPE -- smooth(a, b) is smooth(y, span) when b is one number and smooth(x, y) when it is a vector
fitfit(x,y,model[,"Name",value,...])f = the model fitted to the data by least squares -- MATLAB's Curve Fitting fit (T8.1-T8.3). model is a library name ("poly1".."poly9", "exp1", "exp2", "power1", "power2", "rat11".."rat55", "fourier1".."fourier8", "gauss1".."gauss8", "sin1".."sin8", "weibull") or a fittype. ⚠ x AND y ARE COLUMNS -- MATLAB refuses a row with "X must be a matrix with one or two columns.", which is what prepareCurveData is for. ⚠ The START POINT is the answer for a nonlinear model, and MATLAB's own rules are transcribed; rat*, weibull and a custom model with no "StartPoint" start at 1 for every coefficient, where MATLAB draws a RANDOM start and warns. Options: "StartPoint", "Lower", "Upper", "Weights", "Exclude", "Normalize", "Robust", or a fitoptions(...) set. ⚠ SURFACES: fit([x y], z, "poly00".."poly55") takes TWO independent variables as the two COLUMNS of one matrix and answers MATLAB's sfit (T8.13). The term set is not the whole grid -- x^i*y^j is in polyIJ when i<=I and j<=J and i+j<=max(I,J) -- and "Normalize" is a curve option there. The scattered-data surface interpolants (linearinterp, cubicinterp, thinplateinterp, biharmonicinterp) are refused by name: they need a triangulation or a radial-basis solve this console has nothing to hold
fitoptionsfitoptions([opts|ft,]["Name",value,...])The option SET fit() reads (T8.7), as a string carrying its own canonical call -- odeset's and optimoptions' shape (T0.6), not a struct. fitoptions(ft) answers the set that model runs on. ⚠ THE PROPERTY LIST IS PER METHOD and a name off the sheet is REFUSED with MATLAB's own sentence: "StartPoint" is not a LinearLeastSquares property. MATLAB's defaults, which are this console's: Algorithm "Trust-Region", MaxIter 400, MaxFunEvals 600, TolFun 1e-6, TolX 1e-6, Robust "Off", Normalize "off"
spapsspaps(x,y,tol[,w[,m]])The smoothing spline chosen by TOLERANCE (T8.15) -- csaps's dual, which takes the parameter instead. [sp, values, rho] = spaps(...) hands back the smoothed values at the sites and the smoothing parameter Reinsch's iteration settled on. m is 1, 2 or 3 (the derivative whose integral is penalised; 2, the default, is the usual cubic smoothing spline). ⚠ A NEGATIVE tol names rho directly and skips the iteration. ⚠ The default weights are the TRAPEZOIDAL rule, not ones, so the two end samples carry half the weight of an interior one.
linkagelinkage(X[,method[,metric[,p]]])The hierarchical cluster tree of the ROWS of X, as MATLAB's (n-1) by 3 matrix: the two things joined, and the distance they were joined at. A leaf is 1..n and the cluster made by row k is numbered n+k. Methods: "single" (default), "complete", "average", "weighted", "centroid", "median", "ward". A ONE-ROW X is read as a condensed distance row, as pdist answers one; anything taller is points. Average, weighted, complete and ward have their rows re-sorted by distance and renumbered afterwards, the other three keep merge order
clustercluster(Z,"Cutoff",c|"MaxClust",k[,"Criterion",crit][,"Depth",d])One cluster number per leaf of the tree Z. "Cutoff" cuts every link at or below c -- by inconsistency coefficient unless "Criterion","distance" says otherwise; "MaxClust" asks for at most k clusters and cuts by DISTANCE unless the criterion is named, which is what cluster.m does and not what its documented default says. cluster(Z,c) positionally is MaxClust when c is a whole number of 2 or more and a Cutoff otherwise
clusterdataclusterdata(X,"MaxClust",k|"Cutoff",c[,"Linkage",m][,"Distance",d][,"Criterion",crit][,"Depth",n])linkage then cluster in one call, over MATLAB's defaults -- single linkage over Euclidean distance. Every cluster option is accepted, plus "Linkage" and "Distance" for the tree it builds first
signtestsigntest(x[,y][,"Alpha",a][,"Tail",t])Are the differences centred on zero, using only their SIGNS? [p,h] = signtest(...) -- the P-VALUE first, which is MATLAB's ordering and the reverse of the T3.11 tests. Differences of exactly zero are dropped; the null is binomial below a hundred of them and normal with a continuity correction above
signranksignrank(x[,y][,"Alpha",a][,"Tail",t])The same question using the RANKS of the differences as well as their signs: [p,h] = signrank(...). Its zero test is not "== 0" -- a pair within eps(x)+eps(y) is dropped. Exact (a count of rank subsets) at fifteen differences or fewer, normal above
ranksumranksum(x,y[,"Alpha",a][,"Tail",t])Two-sample rank sum (Mann-Whitney U), on samples of any lengths: [p,h] = ranksum(x,y). The statistic is the rank sum of the SMALLER sample, so which argument that is decides what a one-sided test means. Exact only when the smaller sample is under ten AND the pooled sample under twenty, normal otherwise
vartestvartest(x,v[,"Alpha",a][,"Tail",t])Is the variance of x equal to v? [h,p,ci] = vartest(...): the decision, the p-value and a confidence interval for the variance, from a chi-square on sum((x-mean(x))^2)/v with n-1 degrees of freedom. MATLAB's fourth output is a struct and is refused
vartest2vartest2(x,y[,"Alpha",a][,"Tail",t])Do two samples have the same variance? [h,p,ci] = vartest2(...), from an F on the ratio of the two variances. MATLAB's fourth output is a struct and is refused
chi2gofchi2gof(x[,"NBins",n][,"Emin",m][,"NParams",k][,"Alpha",a])Chi-square goodness of fit against a NORMAL fitted to x: [h,p] = chi2gof(...). Ten equal-width bins by default, then neighbouring bins are POOLED from whichever end expects less until every bin expects at least Emin (5), so the degrees of freedom depend on the data. MATLAB's third output is a struct and is refused
runstestrunstest(x[,v][,"Alpha",a][,"Tail",t])Are the values above and below v in random order? [h,p] = runstest(...). The default v is the MEAN, not the median, and values exactly equal to v are dropped. The p-value is exact -- a closed form in binomial coefficients over the number of runs. MATLAB's third output is a struct and is refused; its "ud" variant needs a data file this console does not ship
ecdfecdf(y[,"Function",f][,"Censoring",c][,"Frequency",w][,"Alpha",a])The empirical (Kaplan-Meier) distribution: [f,x] = ecdf(y) answers ONE MORE point than there are distinct values, because the first row is the estimate before any observation. "Function" is "cdf", "survivor" or "cumulative hazard"; [f,x,lo,up] adds Greenwood's confidence bounds, whose first entry is NaN
ksdensityksdensity(y[,xi][,"Bandwidth",u][,"Kernel",k][,"Support",s][,"Function",f][,"NumPoints",m])A kernel density estimate. The DEFAULT BANDWIDTH is median(\|y-median(y)\|)/0.6745 times (4/(3n))^(1/5) -- a median absolute deviation, not a standard deviation -- and the default grid is 100 points spanning the data plus three bandwidths each way. [f,xi,u] answers the curve, its points and the bandwidth used. "Support" is "unbounded", "positive" or [L U], through MATLAB's log correction
jackknifejackknife(jackfun,X,...)The leave-one-out samples: row i is jackfun of the data without row i, flattened to a row. Deterministic -- the one name in this group that is, and the one with digit parity against MATLAB
bootstrpbootstrp(nboot,bootfun,d,...)nboot rows, each bootfun of a sample of n rows drawn WITH replacement. The draws come from this console's Mersenne Twister and never match MATLAB's stream sample for sample, whatever the seed
bootcibootci(nboot,bootfun,d,...[,"Alpha",a][,"Type",t])A 2 x k bootstrap confidence interval, lower row then upper. The default type is "bca", the bias-corrected and accelerated one, whose acceleration is a JACKKNIFE of the same statistic; "per" and "norm" are the other two. "stud" is a bootstrap inside a bootstrap and is refused
datasampledatasample(data,k[,dim][,"Replace",tf][,"Weights",w])k rows (dim 1, the default) or columns (dim 2) drawn from data, WITH replacement by default
idinputidinput(N[,type[,band[,levels[,sinedata]]]])An excitation signal, MATLAB's idinput. The type is "prbs" (a maximal-length shift register, deterministic), "rbs" (the DEFAULT -- random binary), "rgs" (random gaussian) or "sine" (a multisine whose phases are drawn and whose best of ten trials is kept). N is the period, or [period inputs], or [period inputs periods]. For "prbs" the band's upper edge is a CLOCK -- every register bit is held 1/high samples -- and a period that is not 2^n-1 answers the first N of the next full sequence. [u, freqs] = idinput(N, "sine") also answers the DFT frequencies it summed, which are deterministic where its samples are not
dctdct(x[,n][,"Type",t])Discrete cosine transform, ORTHONORMAL in all four variants (t = 1..4, default 2), column by column for a matrix. n truncates or zero-pads first
idctidct(y[,n][,"Type",t])Inverse discrete cosine transform -- the forward matrix transposed, which is what orthonormal buys
cztczt(x[,m[,w[,a]]])Chirp z-transform: m points along the spiral a*w^-j. The defaults (m = numel(x), w = exp(-2i*pi/m), a = 1) make it the DFT; a smaller w angle zooms into part of the circle
freqzfreqz(b,a[,n|w][,"whole"][,fs]) / freqz(sos,...)Digital frequency response. A SCALAR third argument is a point count (default 512 over [0,pi), so pi itself is not sampled), a VECTOR is your own grid, returned unchanged; "whole" takes the full circle and fs answers in Hz. [h, w] = freqz(...) reports the grid, which four spellings lay out four ways
rmsrms(x)Root mean square, sqrt(mean(x.^2)). Core MATLAB's name rather than the Signal Processing Toolbox's, landed here because the core board is closed
obwobw(x[,fs[,[],P]])Occupied bandwidth: the band holding P percent of the power (99 by default). [bw, flo, fhi, pwr] = obw(...) reports the band
powerbwpowerbw(x[,fs[,[],R]])Power bandwidth: the band whose density stays within R dB of the peak (3 by default). DC and Nyquist are DOUBLED before the peak is found, because a one-sided density has folded them once
periodogramperiodogram(x[,window[,nfft[,fs]]][,"twosided"][,"power"])Power spectral density of the WHOLE record: one window, one transform. The default window is RECTANGULAR (not Hamming) and nfft defaults to max(256, 2^nextpow2(n)). [pxx, f] = periodogram(...) reports the grid
pwelchpwelch(x[,window[,noverlap[,nfft[,fs]]]])Welch's averaged density: the record cut into overlapping segments, each windowed and transformed, the periodograms averaged. Defaults are EIGHT segments with 50% overlap, so the segment length is fix(n/4.5); a SCALAR window is a length (Hamming), a vector is the window
cpsdcpsd(x,y[,window[,noverlap[,nfft[,fs]]]])Cross power spectral density by Welch's method -- COMPLEX, because its phase is the lag between the two signals
mscoheremscohere(x,y[,window[,noverlap[,nfft[,fs]]]])Magnitude-squared coherence \|Pxy\|^2 / (Pxx*Pyy): how much of y is linearly explained by x at each frequency, between 0 and 1
tfestimatetfestimate(x,y[,window[,noverlap[,nfft[,fs]]]])Transfer-function estimate Pyx/Pxx -- the system that takes x to y. NOT tfest, which fits a model to time data
spectrogramspectrogram(x[,window[,noverlap[,nfft[,fs]]]])Short-time transform: one COMPLEX column per segment. [s, f, t] = spectrogram(...) adds the frequency and time axes, and a fourth output is the PSD of each segment
fir1fir1(n,Wn[,ftype][,window][,"noscale"])Windowed linear-phase FIR -- and the window multiplies firls's answer, not a sinc, which is MATLAB's own construction. Wn is normalised to NYQUIST; the default window is Hamming and the default scaling gives unit gain in the middle of the first band
fir2fir2(n,f,m[,npt[,lap]][,window])Frequency-sampling FIR: interpolate the template onto a dense grid, give it an n-tap linear phase, transform back and window. f starts at 0 and ends at 1
findpeaksfindpeaks(y[,fs|x][,"Name",value...])Local maxima: a sample STRICTLY greater than both neighbours, a plateau counting once at its first sample. [pks, locs, w, p] = findpeaks(...) adds the locations, the width at half PROMINENCE (not half height) and the prominence -- how far the peak stands above the higher of the two lowest points reached before the signal rises above it again. Options: MinPeakHeight, MinPeakProminence, MinPeakWidth, MaxPeakWidth, MinPeakDistance, Threshold, NPeaks, SortStr, WidthReference
gradientgradient(A[,hx[,hy]])MATLAB's numeric gradient: central differences inside, one-sided at the ends, so the answer has the shape of A. For a matrix this is FX, the derivative across the columns; [FX, FY] = gradient(A) adds the derivative down the rows
polypoly(A) / poly(r)Characteristic polynomial as a coefficient ROW: of a square matrix, or of a vector of roots
polynomialpolynomial([..])Polynomial value from descending coefficients (the console's own constructor; MATLAB has no object for it)
timeSeriestimeSeries(time,values)Time series from an N-element time vector and an N x M value matrix
timeseries.time()Time vector of a time series, as an N x 1 matrix
valuesseries.values()Value block of a time series, as an N x M matrix
grpdelaygrpdelay(b,a[,n|w][,"whole"][,fs])Group delay in SAMPLES and its grid: [gd, w]. Smith's algorithm for an FIR filter, Shpak's over second-order sections for an IIR one
phasezphasez(b,a[,n][,"whole"][,fs])UNWRAPPED phase and its grid: [phi, w] -- unwrapped on a finer grid and decimated back, which angle(freqz(...)) is not
rootsroots(p)Roots of a polynomial / coefficient vector, as a column -- complex when they are, real when every root is
zeroszeros(n) / zeros(m,n) / zeros([m n])Matrix of zeros: n x n, or m x n
kalmankalman(sys, Qn, Rn[, Nn][, "current"|"delayed"]) / [kest, L, P] = kalman(...)The Kalman filter for a plant whose LAST inputs are the process noise (as many as Qn is wide). kest takes [u; y] and answers [y_e; x_e]; L is the gain and P the error covariance
pidpid(Kp[,Ki[,Kd[,Tf[,Ts]]]]) / pid(sys)Parallel-form PID as a model: Kp + Ki/s + Kd*s/(Tf*s + 1), discretised by MATLAB's default forward Euler when Ts is given. ⚠ The FILTER POLE BELONGS TO THE DERIVATIVE TERM, so pid(2,3,0,0.5) is (2s + 3)/s and not a second-order model. ⚠ And a discrete PID is NOT the continuous one with s replaced: with a filter the derivative term is Kd/(Tf + Ts/(z-1)), which is not Kd*(z-1)/Ts over anything
pidstdpidstd(Kp[,Ti[,Td[,N[,Ts]]]]) / pidstd(sys)Standard-form PID: Kp*(1 + 1/(Ti*s) + Td*s/((Td/N)*s + 1)) -- the SAME rational function pid answers with Ki = Kp/Ti, Kd = Kp*Td and Tf = Td/N, so only the display and the gain NAMES differ. ⚠ An absent term is an INFINITE Ti or N here where the parallel form spells it as a zero, which is what pidstd(Kp) and pidstd(Kp,Ti) mean
pidtuneOptionspidtuneOptions(["Name", value, ...])The option set pidtune takes last. PhaseMargin (default 60) is the target margin in degrees; NumUnstablePoles is accepted and ignored, as MATLAB ignores it for every model kind this console has; DesignFocus takes "balanced" only. The VALUE is the call's own canonical text, the shape optimoptions answers, so it stores and crosses the bridge as a string
appendappend(sys1, sys2, ...)The systems side by side and not connected: every input and every output of each, in order. Always a state-space answer, because that is the kind that holds MIMO here
ttest2ttest2(x, y[, "Vartype", "equal"|"unequal"]) / [h, p, ci] = ttest2(...)Two-sample t-test. "unequal" is Welch: it changes the DEGREES OF FREEDOM to a fractional number, not just the standard error
sprintfsprintf(format, ...)Format values into a string. %d %i %u %o %x %f %e %g %s %c with flags, width and precision; the format CYCLES until the arguments run out, and %d on a non-integer falls back to %e
num2strnum2str(x[,n|format])x as text: MATLAB's own width rules by default (num2str(pi) is 3.1416), n significant digits, or through a sprintf format
int2strint2str(x)x rounded to whole numbers (half away from zero) as text
mat2strmat2str(A[,n])A as text that reads back as an expression: "[1 2;3 4]"; 15 significant digits by default
str2doublestr2double(s)The one number s spells, or NaN -- embedded commas are dropped, "Inf"/"NaN" and a 0x prefix are read
str2numstr2num(s)s read as a literal expression: str2num("[1 2 3]") is a row. MATLAB evaluates it in the caller's workspace; this reads it with no variables
stringstring(x)x as text, the same as num2str(x)
charchar(A)Code points as characters: char([72 73]) is "HI". Truncates toward zero, as MATLAB does
doubledouble(s) / double(A)The code points of a string as a 1 x n row; a logical array as ordinary numbers
regexpregexp(s,pat[,"start"|"end"|"once"|"once","match"])Where a pattern matches: the 1-based start (or end) of every match, the first one with "once", or the matched TEXT with "once","match". ECMAScript syntax
regexpiregexpi(s,pat[,...])regexp ignoring case
regexprepregexprep(s,pat,rep)Every match of pat in s replaced by rep, where $1 is the first group and $0 the whole match
strcatstrcat(s1,s2,...)Join strings, dropping each one's TRAILING whitespace (MATLAB's rule); [s1 s2] keeps it
strcmpstrcmp(a,b)1 when a and b are the same string; 0 for any other pair, including two numbers
strcmpistrcmpi(a,b)strcmp ignoring case
strncmpstrncmp(a,b,n)1 when the first n characters match; 0 when either string is shorter than n
strncmpistrncmpi(a,b,n)strncmp ignoring case
upperupper(s)s in upper case
lowerlower(s)s in lower case
strtrimstrtrim(s)s without leading or trailing whitespace
deblankdeblank(s)s without TRAILING whitespace only
blanksblanks(n)A string of n spaces
newlinenewlineThe newline character, as a one-character string
strlengthstrlength(s)The number of characters in s; length(s) and numel(s) answer the same
strfindstrfind(s,pattern)Every 1-based start position, OVERLAPPING: strfind("aaa","aa") is [1 2]; no match is the 0 x 0 empty matrix
strrepstrrep(s,old,new)Replace at every position strfind reports, overlaps included: strrep("aaaa","aa","b") is "bbb"
replacereplace(s,old,new)Replace scanning left to right without overlaps: replace("aaaa","aa","b") is "bb"
containscontains(s,pattern)1 when pattern occurs in s
startsWithstartsWith(s,pattern)1 when s begins with pattern
endsWithendsWith(s,pattern)1 when s ends with pattern
extractBeforeextractBefore(s,pattern|position)The part of s before the first occurrence of pattern, or before a 1-based position
extractAfterextractAfter(s,pattern|position)The part of s after the first occurrence of pattern, or after a 1-based position
gauspulsgauspuls(t[,fc[,bw[,bwr]]])Gaussian-modulated sinusoidal RF pulse at fc Hz (default 1000) with fractional bandwidth bw (default 0.5) measured bwr dB down (default -6). [yc,ys,ye] = gauspuls(...) also answers the quadrature pulse and the envelope; gauspuls("cutoff",fc,bw,bwr,tpr) answers the time at which the envelope is tpr dB down (default -60)
chirpchirp(t[,f0,t1,f1[,method[,phi[,quadtype]]]])Swept-frequency cosine that is f0 Hz at t = 0 and f1 Hz at t = t1 (defaults 0, 1 and 100). method is "linear" (default), "quadratic" or "logarithmic"; phi is the initial phase in DEGREES; quadtype is "concave" or "convex" and only a quadratic sweep has one

Control System Toolbox#

Row says whether the name is here as a landed row — MATLAB's name, answered MATLAB's way — or as an extra: the console's own, carried ahead of the row that lands MATLAB's form of it, so what a pasted MATLAB call means under that name is not yet settled.

FunctionSignatureRowMeaning
lyaplyap(A,Q) / lyap(A,B,C) / lyap(A,Q,[],E)landedContinuous Lyapunov: solves A*X + X*A' + Q = 0. lyap(A,B,C) is the Sylvester form A*X + X*B + C = 0 -- stated against ZERO, where sylvester(A,B,C) below is stated against C, so the two differ by the sign of C. lyap(A,Q,[],E) is the descriptor form A*X*E' + E*X*A' + Q = 0, and the [] is a placeholder that is not optional
dlyapdlyap(A,Q) / dlyap(A,B,C) / dlyap(A,Q,[],E)landedDiscrete Lyapunov: solves A*X*A' - X + Q = 0; A*X*B - X + C = 0; A*X*A' - E*X*E' + Q = 0
icareicare(A,B,Q[,R]) / [X,K,L] = icare(...)landedContinuous algebraic Riccati equation: A'X+XA-XBR^-1B'X+Q=0. X is the solution, K = R^-1(B'X) the state-feedback gain and L = eig(A-B*K) the closed-loop eigenvalues. R defaults to the identity. MATLAB's current spelling of care()
idareidare(A,B,Q,R) / [X,K,L] = idare(...)landedDiscrete algebraic Riccati equation: A'XA-X-A'XB(R+B'XB)^-1B'XA+Q=0, with K = (B'XB+R)^-1(B'XA). MATLAB's current spelling of dare(); R is not optional here
carecare(A,B,Q[,R]) / [X,L,G] = care(...)landedThe pre-R2019a spelling of icare(): same equation, same numbers -- and a DIFFERENT output order, MATLAB's own. care() answers the closed-loop eigenvalues second and the gain third, where icare() answers the gain second
daredare(A,B,Q,R) / [X,L,G] = dare(...)landedThe pre-R2019a spelling of idare(), with the same [X,L,G] order care() has
freqrespfreqresp(sys,w)landedG at each frequency in w, as a column of complex values. CONTINUOUS models are evaluated at s = jw and DISCRETE ones at z = e^{jwTs}, so a discrete response has nothing above the Nyquist frequency pi/Ts
evalfrevalfr(sys,x)landedG at ONE point of the complex plane, used exactly as given: evalfr(G, 2i) is G(2i), not G(2i*j). The one name on this row that does not map its argument through a frequency axis
bandwidthbandwidth(sys[,dbdrop])landedThe first frequency at which \|G\| has fallen dbdrop below its value at zero frequency; MATLAB's default drop is -3. NaN when there is no gain at zero to fall from, Inf when it never falls
getPeakGaingetPeakGain(sys)landed[gpeak, fpeak] -- the peak of \|G\| along the frequency axis and where it is. The peak is EXACT here: for a continuous model \|G(jw)\|^2 is a rational function of w^2, so its stationary points are polynomial roots rather than a search. MATLAB's fpeak is where its bisection stopped and differs in the third digit; the peak values still agree to 2e-7, because a peak is flat at its top
seriesseries(sys1,sys2)landedsys1 THEN sys2 -- the product sys2*sys1. For a SISO pair the two orders are the same transfer function, so the order shows only in a state-space realisation
parallelparallel(sys1,sys2)landedThe two systems side by side over one input: sys1 + sys2
feedbackfeedback(G,H[,sign])landedThe closed loop G/(1 + G*H). NEGATIVE feedback by default; sign = +1 closes G/(1 - G*H), and the two share a numerator. feedback(G, 1) is the unity loop -- the 1 is an ordinary static gain, not a special form
zpkzpk(z,p,k[,Ts]) / zpk('s') / zpk('z',Ts) / zpk(sys) / zpk(k)landedZero/pole/gain model: the zeros, the poles and the scalar gain, kept FACTORED (Ts > 0 makes it discrete). zpkdata answers the numbers that went in, arithmetic answers a zpk the way MATLAB's does, and tf(H) / ss(H) convert. Displayed as MATLAB displays it -- the factored fraction, with a conjugate pair as its real quadratic
tftf(num,den[,Ts]) / tf('s') / tf('z',Ts) / tf(sys) / tf(k)landedTransfer function: from descending coefficient vectors (Ts > 0 makes it discrete); the Laplace variable s or the shift variable z at sample time Ts, so 1/(s+1) is a model; from a SISO state-space model; or a static gain. Improper models are values -- what MATLAB refuses for one (a time response, ss(G), a zoh c2d) is refused there. Displayed as MATLAB displays it
ssss(A,B,C,D[,Ts]) / ss(sys)landedState-space model from conformant matrices of any size (MIMO allowed), or the controller-canonical realization of a proper SISO transfer function. Displayed as MATLAB displays it
tfdatatfdata(sys,"v")landed[num, den, Ts] = the transfer function's coefficient rows. ⚠ The numerator is LEFT-PADDED to the denominator's length, so tfdata(tf([1 3],[1 2 5]),"v") is [0 1 3] and not [1 3]; and Ts is 0 for a continuous model, which is MATLAB's convention rather than this console's stored -1. Without the "v" MATLAB answers a cell, which this console has no kind for and refuses by name
zpkdatazpkdata(sys,"v")landed[z, p, k] = the model's zeros, poles and scalar gain. z and p are COMPLEX COLUMNS -- damp's third-output shape, not the N x 2 [real, imag] pole() still uses -- and k is the ratio of the two leading coefficients, the same number zero()'s second output answers
ssdatassdata(sys)landed[A, B, C, D] = the state-space matrices. Of an ss this is a plain read. ⚠ Of a TRANSFER FUNCTION it is a REALIZATION, and realizations are conventions: this console answers the controller canonical form -- which is what MATLAB's own tf2ss(num, den) answers -- while MATLAB's ssdata answers a diagonally scaled version of it that it does not publish. Both are the same system; ss2tf of either gives the transfer function back
polepole(G|sys)landedPoles of a transfer function or state-space model
zerozero(G)landedTransmission zeros of a transfer function
pzmappzmap(sys) / [p, z] = pzmap(sys)landedPoles and zeros of a model: one output is the POLES, two are [p, z]; the bare statement draws the pole-zero map
dcgaindcgain(G)extraDC gain of a transfer function
isstableisstable(G|p)extra1 if stable, else 0
dampdamp(sys) / [wn, zeta, p] = damp(sys)landedNatural frequencies (rad/s), damping ratios and poles, sorted by increasing frequency
orderorder(sys)landedNumber of states: the denominator degree of a proper transfer function
isctisct(sys)landed1 for a continuous-time (or static) model
isdtisdt(sys)landed1 for a discrete-time (or static) model
isproperisproper(sys)landed1 when the numerator degree does not exceed the denominator's
issisoissiso(sys)landed1 for a single-input single-output model
minrealminreal(G[, tol])landedCancels pole/zero pairs matching to within tol relative to the pole (default sqrt(eps))
d2cd2c(sysd[, method])landedDiscrete model back to continuous time: "zoh" (default) or "tustin"
d2dd2d(sysd, Ts)landedRe-samples a discrete model at a new sample time
c2dc2d(sys, Ts[, method])landedContinuous model to discrete: "zoh" (default), "foh", "tustin" or "impulse". "matched" is refused -- the routine behind it is the zoh routine
ss2ssss2ss(sys, T)landedThe same model in the state basis xbar = T*x
canoncanon(sys, "companion") / [csys, T] = canon(...)landedThe companion realization: B is e1 and the last column of A is the characteristic polynomial. The modal form is refused -- its normalization is bdschur's and is not published
balrealbalreal(sys) / [sysb, g, T, Ti] = balreal(sys)landedThe balanced realization, in which both gramians equal diag(g) -- the Hankel singular values, the energy each mode carries. Stable, minimal models only
modredmodred(sys, elim[, "MatchDC"|"Truncate"])landedRemoves the listed states. MatchDC (the default) solves them out and keeps the DC gain exactly; Truncate simply deletes them
lqelqe(A, G, C, Q, R[, N]) / [L, P, E] = lqe(...)landedThe same design under its classical spelling, with the noise map G as an argument. The gain comes FIRST here and the estimator model does not appear at all
estimestim(sys, L)landedThe estimator for a gain you already have. Its inputs are the MEASUREMENTS alone -- MATLAB treats no plant input as known unless told
pidtunepidtune(sys, type[, wc][, opts]) / [C, info] = pidtune(...)landedTune a P, I, PI, PD or PID controller for a plant. ⚠ THE GAINS ARE NOT MATLAB'S AND ARE NOT MEANT TO BE: MATLAB's loop shaping is unpublished, so this console runs its own documented rule -- put the loop's gain crossover where the structure has the most phase to spare on either side, then meet \|L\| = 1 and a 60 degree margin there exactly (PID spends its third gain on a COINCIDENT pair of controller zeros). What both sides promise is the PROPERTY: a stable loop whose margin is at least the target, and exactly the crossover you named if you named one. [C, info] adds Stable, CrossoverFrequency and PhaseMargin, all read back off C*G
marginmargin(sys) / [Gm, Pm, Wcg, Wcp] = margin(sys)landedStability margins. Gm is ABSOLUTE, not dB; Pm is in degrees. ⚠ Wcg is where the PHASE crosses -180 and Wcp where the GAIN crosses 1 -- each frequency is named for the margin it is read for, not the crossing it is. Inf and NaN when there is no crossing
padepade(tau, n) / [num, den] = pade(tau, n)landedCoefficient rows of the Pade approximation of a delay e^(-tau*s), monic and in descending powers; one output is the numerator. pade(tau, 0) drops the delay
covarcovar(sys, W) / [P, Q] = covar(sys, W)landedSteady-state output (and state) covariance under white noise of intensity W
ctrbctrb(sys)landedControllability matrix
obsvobsv(sys)landedObservability matrix
bodebode(sys[,w|wmin,wmax]) / [m,p,w] = bode(...) / bode(G,wStart,wEnd,n)landedFrequency response over MATLAB's own adaptive grid: one output is the magnitude (ABSOLUTE, not dB), two add the phase in DEGREES (unwrapped), three add the grid. bode(sys, w) evaluates at frequencies you give, in the order you give them; bode(sys, wmin, wmax) is MATLAB's bode(sys, {wmin, wmax}) -- a whole grid inside that range, spelled with two scalars because the console has no cell arrays. The FOUR-argument form is the console's own logarithmic sweep and answers N x 3 [omega, \|G\| in dB, phase in RADIANS]. Unbound, bode(sys) draws
bodemagbodemag(sys[,w|wmin,wmax])landedDraws the magnitude alone. It has no value form on either side -- m = bode(sys) is the magnitude as a value
nyquistnyquist(sys[,w|wmin,wmax]) / [re,im,w] = nyquist(...) / nyquist(G,wStart,wEnd,n)landedG(jw) on the complex plane over MATLAB's own grid, which for this verb is denser than bode's and reaches w = 0 when the response is finite there: one output is the REAL part, two add the imaginary, three add the grid. The four-argument form is the console's own sweep, N x 2 [real, imag]. Unbound, it draws
nicholsnichols(sys[,w|wmin,wmax]) / [m,p,w] = nichols(...)landedbode's numbers on bode's grid at Nichols' grade -- the same magnitude and unwrapped phase in degrees, over a grid refined on evenly spaced PHASE and given half a decade more at each end. Unbound, it draws gain against phase
sigmasigma(sys[,w|wmin,wmax]) / [sv,w] = sigma(...)landedSingular values of the frequency response, which for a SISO model are \|G\| -- answered as a 1 x N ROW, MATLAB's shape. ⚠ Its automatic grid differs between a tf and the SAME system as an ss, because MATLAB reads the focus off the complex response for one and off the singular values for the other; this console mirrors that
rlocusrlocus(sys,k) / [r,k] = rlocus(sys,k)landedClosed-loop poles under unity feedback at the gains you name: r is order x numel(k) COMPLEX, one column per gain. ⚠ The bare rlocus(sys) does not answer VALUES -- MATLAB picks its automatic gains inside a compiled routine, so there are no numbers to agree with -- but the bare statement still DRAWS, over the console's own gain sweep
lqrlqr(A,B,Q,R[,N]) / lqr(sys,Q,R[,N]) / [K,S,P] = lqr(...)landedLinear-quadratic regulator: the gain K minimising the integral of x'Qx + u'Ru (+ 2x'Nu). S is the Riccati solution and P the closed-loop eigenvalues -- MATLAB's order, gain FIRST, unlike care()'s. A MODEL argument designs against its own time base, so lqr(sysd,...) is the discrete design
dlqrdlqr(A,B,Q,R[,N]) / [K,S,P] = dlqr(...)landedThe discrete regulator over matrices: the same design lqr() does for a model with a sample time
lqilqi(sys,Q,R[,N]) / [K,S,P] = lqi(...)landedThe regulator for the plant AUGMENTED with an integrator of the tracking error, so Q is (states + outputs) square. Discrete plants integrate by forward Euler, which puts the sample time in the added rows
lqrylqry(sys,Q,R[,N]) / [K,S,P] = lqry(...)landedThe regulator with the weights written against the OUTPUT: y'Qy + u'Ru, which is Q -> C'QC and R -> R + D'QD on the state form
ctrbfctrbf(A,B,C[,tol]) / [Abar,Bbar,Cbar,T,k] = ctrbf(...)landedControllability staircase: an ORTHOGONAL change of basis separating the uncontrollable modes (leading block) from the controllable ones. sum(k) is the controllable rank
obsvfobsvf(A,B,C[,tol]) / [Abar,Bbar,Cbar,T,k] = obsvf(...)landedObservability staircase -- the same routine on the dual system
gramgram(sys,"c"|"o")landedControllability or observability gramian: the Lyapunov solution A*Wc + Wc*A' + B*B' = 0 (or its discrete twin), which exists only for a stable plant
placeplace(A,B,p) / [K,prec] = place(A,B,p)landedState-feedback gain placing eig(A-B*K) at p, by robust assignment (Kautsky-Nichols-Van Dooren). Takes as many inputs as B has columns; no pole may repeat more often than that. prec is how many decimal digits of p the gain actually delivers
ackeracker(A,B,p)landedAckermann's formula for the same gain, SINGLE INPUT only -- and there the gain is unique, so acker and place answer the same numbers. Numerically unreliable past order 10 (MATLAB's own warning), which is why place exists
gensiggensig(type,tau[,Tf[,Ts]]) / [u,t] = gensig(...)landedControl System test input for lsim: a periodic "sine", "square" or "pulse" of period tau SECONDS, sampled every Ts (default tau/64) for Tf seconds (default 5*tau). The square and the pulse run 0 to 1, where Signal Processing's square(t) next door runs -1 to +1 over a period of 2*pi radians
rootlocusrootlocus(G,gains)extraClosed-loop poles under unity feedback, swept over gains (Nx2 [real,imag])
stepstep(sys[,Tfinal|t]) / [y,t,x] = step(...) / step(G,duration,points)landedStep response: y (and t, and x for an ss) over MATLAB's own grid; the three-argument form is the console's N x 2 time series
impulseimpulse(sys[,Tfinal|t]) / [y,t,x] = impulse(...) / impulse(G,duration,points)landedImpulse response, MATLAB's grid and MATLAB's 1/Ts discrete height; the three-argument form is the console's time series
lsimlsim(sys,u,t[,x0]) / [y,t,x] = lsim(...)landedResponse to an arbitrary input on the caller's own time grid; MATLAB's hold rule -- first-order for a smooth input, zero-order for one with a jump in it
initialinitial(sys,x0[,Tfinal|t]) / [y,t,x] = initial(...)landedFree response of a state-space model from x0; a transfer function has no state to start from
rampramp(G[,duration[,points]]) / G.ramp(...)extraRamp response as a time series; no duration picks one from the poles
polezeroG.polezero()extraPlot poles and zeros on one complex plane (plot-only; use poles()/zeros() for values)

Signal Processing Toolbox#

Row says whether the name is here as a landed row — MATLAB's name, answered MATLAB's way — or as an extra: the console's own, carried ahead of the row that lands MATLAB's form of it, so what a pasted MATLAB call means under that name is not yet settled.

FunctionSignatureRowMeaning
xcorr2xcorr2(A[,B])landed2-D cross-correlation of two matrices (the autocorrelation of one), (ma+mb-1) x (na+nb-1) with lag (0,0) at its centre
cconvcconv(a,b[,n])landedCircular convolution of length n (default numel(a)+numel(b)-1, at which it is the linear one); a longer sequence WRAPS onto n samples
finddelayfinddelay(x,y[,maxlag])landedDelay of y relative to x in samples, from the largest normalized \|xcorr\| peak. Positive means y is LATER; a tie goes to the smaller \|lag\|, and a peak below 1e-8 answers 0
alignsignalsalignsignals(x,y[,maxlag][,'truncate'])landedDelay the EARLY signal by leading zeros so the two line up. One output is the padded x; [xa, ya, d] reports both signals and finddelay's answer
sosfiltsosfilt(sos,x)landedCascade of biquads: one second-order section per ROW of the L x 6 sos ([b0 b1 b2 a0 a1 a2]), each row divided through by its own a0 and each stage filtering the previous stage's output. Use filtfilt(sos,g,x) for the zero-phase form and its gain vector
fftfiltfftfilt(b,x[,nfft])landedFIR filtering by overlap-add: the same numel(x) samples filter(b,1,x) answers, reached through the FFT. Without nfft the block length is MATLAB's own choice off its published FFT cost table; a given nfft is raised to at least numel(b) and then to the next power of two
medfilt1medfilt1(x[,n][,flags])landedRunning median of an n-wide window (default 3). Endpoints are "zeropad" (the default -- the window stays full and reads zeros past the ends) or "truncate" (the window shrinks, which is what movmedian does). "includenan" (default) makes a window holding a NaN answer NaN; "omitnan" drops them
sgolayfiltsgolayfilt(x,order,frameLength[,w])landedSavitzky-Golay smoothing: a least-squares polynomial of the given order fitted to every frameLength-wide frame (frameLength odd, greater than order). The middle is one FIR pass; each edge is the whole first (last) frame's polynomial evaluated there, not the filter started early
hampelhampel(x[,k[,nsigma]])landedOutlier filter: a sample further than nsigma local standard deviations (default 3) from the median of its 2k+1 window (default k=3) is replaced by that median. [y,i,med,sigma] adds the outlier mask, the moving median and the scaled moving median-absolute-deviation the decision was made on
levinsonlevinson(r[,n])landedLevinson-Durbin over an autocorrelation: the prediction-error polynomial as a ROW beginning with 1. [a, e, k] adds the final prediction error and the reflection coefficients (a column). An order past numel(r)-1 is clamped to it
ac2polyac2poly(r)landedThe prediction-error polynomial of an autocorrelation -- levinson at full order. [a, efinal] adds the error
poly2acpoly2ac(a,efinal)landedThe autocorrelation COLUMN a prediction-error polynomial came from; efinal is the FINAL prediction error and r0 comes back first
poly2rcpoly2rc(a[,efinal])landedReflection coefficients of a prediction-error polynomial, as a column. [k, r0] adds the ZERO-LAG error
rc2polyrc2poly(k[,r0])landedThe prediction-error polynomial of a reflection sequence -- poly2rc backwards. [a, efinal] needs r0 to scale from
lpclpc(x[,p])landedLinear prediction coefficients of a signal by the Yule-Walker equations over its BIASED autocorrelation. [a, g] adds the error, which is aryule's e
aryulearyule(x,p)landedlpc's AR model with the reflection coefficients reported too: [a, e, k]
arburgarburg(x,p)landedAR model by Burg's lattice recursion, which minimises the forward and backward errors together: [a, e, k]
arcovarcov(x,p)landedAR model by the covariance method -- least squares over the un-windowed forward errors. [a, e] adds the noise variance
armcovarmcov(x,p)landedAR model by the MODIFIED covariance method: arcov's solve over the forward and backward errors together
lp2lplp2lp(b,a,Wo)landedMove an analog lowpass prototype to cutoff Wo (s -> s/Wo). One output is the numerator; [bt, at] is the pair
lp2hplp2hp(b,a,Wo)landedAnalog lowpass to HIGHPASS at Wo (s -> Wo/s)
lp2bplp2bp(b,a,Wo,Bw)landedAnalog lowpass to BANDPASS centred at Wo with bandwidth Bw; the order doubles
lp2bslp2bs(b,a,Wo,Bw)landedAnalog lowpass to BANDSTOP centred at Wo with bandwidth Bw; the order doubles
bilinearbilinear(b,a,fs[,fp]) / bilinear(z,p,k,fs[,fp])landedAnalog to discrete by s = 2*fs*(z-1)/(z+1), optionally prewarped so the two responses meet at fp. Coefficient ROWS give [bd, ad]; zero and pole COLUMNS give [zd, pd, kd]
impinvarimpinvar(b,a,fs[,tol])landedAnalog to discrete by SAMPLING the impulse response -- it aliases where bilinear warps. tol is the relative distance within which two poles are one repeated pole
goertzelgoertzel(x[,k])landedThe DFT at the frequency indices k, counted from ONE, all of them when k is omitted. A fractional k lands between bins rather than being refused
butterbutter(n,Wn[,ftype][,'s'])landedButterworth IIR design -- maximally flat, no ripple anywhere. Wn is normalised to NYQUIST (strictly between 0 and 1), NOT to the sample rate and not in Hz; ftype is "low", "high", "bandpass" or "stop" and a two-element Wn makes it a band design; 's' asks for an analog filter, where Wn is in rad/s. [b, a] is the coefficient pair, [z, p, k] the factored form, and a SINGLE output is the numerator alone -- which is MATLAB's answer and surprising, so it is this console's
cheby1cheby1(n,Rp,Wp[,ftype][,'s'])landedChebyshev type I IIR design: ripple Rp dB in the PASSBAND, flat stopband, and a steeper skirt than Butterworth at the same order. An EVEN order starts its ripple LOW rather than at unit gain, on both sides. Same outputs and same Nyquist convention as butter
cheby2cheby2(n,Rs,Ws[,ftype][,'s'])landedChebyshev type II IIR design: flat passband, ripple Rs dB in the STOPBAND. ⚠ Its band edge is the STOPBAND edge where cheby1's third argument is the passband one -- the same position means a different frequency between the two names, which is MATLAB's arrangement
ellipellip(n,Rp,Rs,Wp[,ftype][,'s'])landedElliptic (Cauer) IIR design: ripple in BOTH bands and the steepest skirt an order can give. Passband ripple first, then stopband attenuation, then the PASSBAND edge
besselfbesself(n,Wo[,ftype])landedBessel IIR design: flattest DELAY rather than flattest magnitude. ⚠ ANALOG whatever you pass, so Wo is in rad/s and there is no digital Bessel filter to ask for -- and besself(n, Wo, 's') is an ERROR rather than a redundant flag, because the shared parser is handed 's' already and counts two. MATLAB refuses it for the same reason
buttordbuttord(Wp,Ws,Rp,Rs[,'s'])landed[n, Wn] = the smallest Butterworth order meeting the brief, and the natural frequency to design it at. ⚠ buttord alone COMPUTES its Wn -- the -3 dB point that puts exactly Rs dB at the stopband edge -- where its three siblings hand back an edge they were given. Its bandstop branch minimises a cost with fminbnd on both sides, so that case is two iterations agreeing rather than two formulas
cheb1ordcheb1ord(Wp,Ws,Rp,Rs[,'s'])landed[n, Wn] = the smallest Chebyshev I order meeting the brief. Wn is the PASSBAND edge it was given back -- for a bandstop, the edge the optimiser moved and not the one written in the call
cheb2ordcheb2ord(Wp,Ws,Rp,Rs[,'s'])landed[n, Wn] = the smallest Chebyshev II order meeting the brief. Wn is the STOPBAND edge for a digital specification
ellipordellipord(Wp,Ws,Rp,Rs[,'s'])landed[n, Wn] = the smallest elliptic order meeting the brief, over the complete elliptic integrals. Its bandstop branch is the one shape that does not iterate: it converts the edges through a centre and recurses into the analog lowpass case
upsampleupsample(x,n[,phase])landedn - 1 zeros inserted after every sample, starting at phase. EXACT on both sides -- nothing is computed
downsampledownsample(x,n[,phase])landedEvery n-th sample from phase; the inverse of upsample at the same phase, and exact for the same reason
decimatedecimate(x,r[,n][,"fir"])landedLowpass, then keep every r-th sample. ⚠ The ARM is part of the answer: the default is an 8th-order Chebyshev I through filtfilt (zero phase, nothing to correct) and "fir" is a 30-tap fir1 in ONE forward pass whose group delay is corrected -- the two give different numbers for the same signal, on both sides
interpinterp(x,r[,n[,cutoff]])landedUpsample by r and interpolate with a symmetric FIR. The property worth knowing is that y(1:r:end) IS x -- interp designs a filter that passes the original samples through, which a general lowpass does not
resampleresample(x,p,q[,n[,beta]])landedRate change by the rational factor p/q through a Kaiser-windowed FIR, with the filter's delay removed. ⚠ p and q are reduced to lowest terms BEFORE anything is designed, so resample(x,4,6) IS resample(x,2,3) -- filter and all
upfirdnupfirdn(x,h[,p[,q]])landedUpsample by p, filter by h, downsample by q, in one pass. The output length is ceil(((numel(x)-1)*p + numel(h))/q) -- the full convolution thinned by q, so a filter longer than the signal still lengthens the answer
buttapbuttap(n)landedButterworth analog lowpass prototype: [z, p, k] with no zeros and n poles on the unit circle. Maximally flat -- the one approximation with no ripple anywhere
cheb1apcheb1ap(n,Rp)landedChebyshev I prototype: ripple Rp dB in the PASSBAND, no zeros. An even order starts a ripple low, which is MATLAB's gain patch and not a defect
cheb2apcheb2ap(n,Rs)landedChebyshev II prototype: flat passband, ripple Rs dB in the STOPBAND, and zeros on the imaginary axis
ellipapellipap(n,Rp,Rs)landedElliptic prototype: ripple in BOTH bands and the steepest skirt an order can give. Rp must be above 0 and below Rs
besselapbesselap(n)landedBessel prototype: flattest DELAY rather than flattest magnitude. Poles are the reverse Bessel polynomial's roots scaled so prod(-p) is 1 -- NOT the -3 dB normalisation, so its cutoff is not at 1 rad/s
peak2peakpeak2peak(x)landedmax(x) - min(x)
peak2rmspeak2rms(x)landedmax(abs(x)) / rms(x) -- the crest factor
rssqrssq(x)landedRoot sum of squares, sqrt(sum(x.^2)) -- the signal's Euclidean length
bandpowerbandpower(x) / bandpower(x,fs,[flo fhi])landedAverage power. With no band it is mean(x.^2) EXACTLY -- no window, no transform; with one it integrates a Hamming periodogram over the band
meanfreqmeanfreq(x[,fs])landedThe spectrum's centre of mass. [f, p] = meanfreq(...) adds the power in the band
medfreqmedfreq(x[,fs])landedThe frequency that halves the spectrum's power, interpolated between bin MIDPOINTS so it lands between bins
firlsfirls(n,f,a[,w])landedLeast-squares linear-phase FIR: the filter whose response is closest to the piecewise-LINEAR template (f, a) in the weighted mean square. f runs 0..1 in band pairs, 1 being Nyquist. The Hilbert and differentiator types are refused with a reason
kaiserordkaiserord(f,a,dev[,fs])landedKaiser's estimate of the order a windowed design needs; [n, Wn, beta, ftype] = kaiserord(...) answers the whole brief fir1 wants. f holds the TRANSITION edges, two per gap between bands
sgolaysgolay(order,frameLength[,w])landedThe Savitzky-Golay projection B: row (frameLength+1)/2 is the smoothing filter for the middle of a frame and the rows either side of it are the filters for each edge position. [B, G] = sgolay(...) adds the differentiation matrix, whose column k+1 estimates the k-th derivative (times k!)
firpmfirpm(n,f,a[,w])landedEquiripple linear-phase FIR by the Remez exchange: the filter whose largest WEIGHTED error is as small as it can be, which is a different filter from firls's least-squares one and usually shorter for the same specification. [b, err] = firpm(...) reports the converged ripple
firpmordfirpmord(f,a,dev[,fs])landedHerrmann's estimate for an EQUIRIPPLE design; [n, fo, ao, w] = firpmord(...) answers the brief firpm wants. A different filter from kaiserord's, so a different -- usually smaller -- order
pyulearpyulear(x,order[,nfft[,fs]])landedAR power spectral density by the Yule-Walker fit (aryule): v * \|1/A(e^jw)\|^2, folded one-sided and scaled by 2*pi (or by fs). [pxx, w] = pyulear(...) reports the grid. nfft defaults to 256
pburgpburg(x,order[,nfft[,fs]])landedThe same density over Burg's fit (arburg), which minimises the forward and backward prediction errors together
pcovpcov(x,order[,nfft[,fs]])landedThe same density over the covariance fit (arcov): least squares over the un-windowed data matrix, forward errors only
pmcovpmcov(x,order[,nfft[,fs]])landedThe same density over the modified covariance fit (armcov): forward and backward errors together, un-windowed
hilberthilbert(x[,n])landedThe analytic signal: the same signal with its NEGATIVE frequencies removed and its positive ones doubled, so real(hilbert(x)) is x, abs() is the instantaneous amplitude and angle() the instantaneous phase. n is the FFT length, and the answer has n samples
envelopeenvelope(x[,n,method])landedUpper envelope; [yu, yl] = envelope(...) adds the lower. Default: the magnitude of the analytic signal of the mean-removed x. method "analytic" uses an n-tap FIR Hilbert filter instead, "rms" a sliding root-mean-square of length n, "peaks" a spline through the peaks at least n samples apart -- the only method whose two envelopes are not mirror images
freqsfreqs(b,a,w)landedAnalog frequency response b(jw)/a(jw). The frequency vector is not optional -- an analog filter has no sample rate to spread a default grid over
tf2sstf2ss(G) / tf2ss(num,den)landedA MODEL's state-space realization; with two coefficient ROWS, MATLAB's controller canonical form [A, B, C, D]
ss2tfss2tf(sys) / ss2tf(A,B,C,D[,iu])landedA MODEL's transfer function; with the four state matrices, [num, den] from the iu'th input
impzimpz(b,a[,n][,fs])landedImpulse response and its time axis: [h, t]. Without n, MATLAB's impzlength picks the length from the filter's own poles
stepzstepz(b,a[,n][,fs])landedStep response and its time axis: [s, t] -- impz with a step in
tf2zptf2zp(num,den)landedZeros, poles and gain of a coefficient pair: [z, p, k]
zp2tfzp2tf(z,p,k)landedThe coefficient pair of a zero-pole-gain filter: [num, den]
ss2zpss2zp(A,B,C,D[,iu])landedZeros, poles and gain of a realization: [z, p, k]. The poles are eig(A), the zeros the finite generalized eigenvalues of [A - sI, B; C, D]
zp2sszp2ss(z,p,k)landedThe BALANCED second-order cascade of a zero-pole-gain filter: [A, B, C, D] -- pole pairs realized together, not the controller form
tf2sostf2sos(b,a[,order])landedSecond-order sections of a coefficient pair: [sos, g]. order is "up" (default) or "down"
zp2soszp2sos(z,p,k[,order])landedSecond-order sections of a zero-pole-gain filter: [sos, g], paired and ordered MATLAB's way
ss2sosss2sos(A,B,C,D[,iu][,order])landedSecond-order sections of a realization: [sos, g]
sos2tfsos2tf(sos[,g])landedThe cascade multiplied back out: [b, a]
sos2zpsos2zp(sos[,g])landedThe cascade's own roots: [z, p, k]
snrsnr(x[,fs[,n]]) / snr(x,y) / [r,noisePow] = snr(...)landedSignal-to-noise ratio in dB: the fundamental's power over everything that is not it, DC or its first n harmonics (default 6). snr(x, y) with a VECTOR y is the other reading of the name -- 10*log10(sum(x.^2)/sum(y.^2)), no spectrum in it at all
thdthd(x[,fs[,n]]) / [r,harmPow,harmFreq] = thd(...)landedTotal harmonic distortion in dB: the summed power of harmonics 2..n over the fundamental's. harmPow is a COLUMN with the FUNDAMENTAL first, so harmPow(2) is the second harmonic
sinadsinad(x[,fs]) / [r,totDistPow] = sinad(...)landedSignal to noise AND distortion in dB. The one line that separates it from snr: it removes only DC and the fundamental, so the harmonics stay in the noise it measures against
sfdrsfdr(x[,fs[,msd]]) / [r,spurPow,spurFreq] = sfdr(...)landedSpurious-free dynamic range in dB: the fundamental over the largest spur, wherever it is. msd excludes a band around the fundamental
butterlpbutterlp(order,cutoffHz,fsHz)extraDiscrete Butterworth lowpass transfer function
butterhpbutterhp(order,cutoffHz,fsHz)extraDiscrete Butterworth highpass transfer function
butternotchbutternotch(order,centerHz,bandwidthHz,fsHz)extraDiscrete Butterworth band-stop (notch) transfer function
sawtoothsawtooth(t[,width])landedSawtooth wave of period 2*pi over t, rising from -1 to 1 over the first width FRACTION of each period (default 1) and falling back over the rest. width = 0.5 is the triangle wave
squaresquare(t[,duty])landedSquare wave of period 2*pi over t: +1 for the first duty PERCENT of each period (default 50) and -1 for the rest
sincsinc(x)landedThe NORMALISED sinc, sin(pi*x)/(pi*x), which is 1 at 0 and 0 at every other whole number. Not sin(x)/x
rectpulsrectpuls(t[,w])landedUnit-height rectangular pulse of width w (default 1) centred on t = 0; the pulse is closed on the left and open on the right, MATLAB's convention
tripulstripuls(t[,w[,skew]])landedUnit-height triangular pulse of width w (default 1) centred on t = 0, its peak moved to skew*w/2 for a skew in [-1, 1] (default 0, symmetric)
pulstranpulstran(t,d,p,...)landedPulse train: the pulse p shifted to every delay in d and summed. p is a function handle, a function name in quotes (its extra arguments follow), or a sampled prototype interpolated onto the shifted axis with pulstran(t,d,p[,fs][,method]). d is a vector of delays or an M x 2 table of [delay, amplitude] rows
filtfiltfiltfilt(b,a,x)landedZero-phase filter: the filter run forwards and then backwards, so its phase cancels and the answer is the signal filtered by \|H\|^2 with no delay. filtfilt(sos,g,x) takes second-order sections instead. The edges are an ODD reflection of 3*order samples and each pass starts from the filter's DC steady state scaled by the first sample -- MATLAB's own edge handling, which is what the answer mostly is
hannhann(n[,sampling])landedHann (raised-cosine) window, n x 1. sampling is "symmetric" (default, its own mirror -- the one to filter with) or "periodic" (the symmetric window of length n+1 with its last sample dropped -- the one to take a spectrum with)
hamminghamming(n[,sampling])landedHamming window, n x 1: 0.54 - 0.46*cos. Same sampling words as hann
blackmanblackman(n[,sampling])landedBlackman window, n x 1. Same sampling words as hann
flattopwinflattopwin(n[,sampling])landedFlat-top window, n x 1 -- the five-term cosine window whose main lobe is flat, so it measures AMPLITUDE accurately and frequency poorly. It goes NEGATIVE either side of the main lobe. Same sampling words as hann
blackmanharrisblackmanharris(n[,sampling])landedMinimum four-term Blackman-Harris window, n x 1. Same sampling words as hann
nuttallwinnuttallwin(n[,sampling])landedNuttall's minimum four-term Blackman-Harris window, n x 1. Same sampling words as hann
bartlettbartlett(n)landedBartlett (triangular) window, n x 1, ZERO at both ends -- triang(n) is the same shape without the zeros
triangtriang(n)landedTriangular window, n x 1, non-zero at both ends. bartlett(n) is the same shape with zero ends
rectwinrectwin(n)landedRectangular window, n x 1 of ones -- the window you get by not windowing
bohmanwinbohmanwin(n)landedBohman window, n x 1: the convolution of two half-cycle cosines, zero at both ends
parzenwinparzenwin(n)landedParzen (de la Valle-Poussin) window, n x 1 -- the piecewise-cubic B-spline window
gausswingausswin(n[,alpha])landedGaussian window, n x 1. alpha (default 2.5) is the RECIPROCAL of the standard deviation, so a larger alpha is a narrower window
tukeywintukeywin(n[,r])landedTukey (tapered cosine) window, n x 1. r (default 0.5) is the fraction of the length that is tapered: r = 0 is rectwin and r = 1 is hann
kaiserkaiser(n[,beta])landedKaiser window, n x 1. beta (default 0.5) trades main-lobe width against sidelobe height; beta = 0 is rectwin
chebwinchebwin(n[,r])landedDolph-Chebyshev window, n x 1, with every sidelobe r dB below the main lobe (default 100). Equiripple by construction, which no other window here is
windowwindow(f,n[,x])landedThe window f, of length n -- f is a handle (window(@hann, 64)) or the name in quotes (window("kaiser", 64, 5)), and x is that window's own sampling word or parameter. One code path with the direct spellings, so the two cannot disagree

Statistics and Machine Learning Toolbox#

Row says whether the name is here as a landed row — MATLAB's name, answered MATLAB's way — or as an extra: the console's own, carried ahead of the row that lands MATLAB's form of it, so what a pasted MATLAB call means under that name is not yet settled.

FunctionSignatureRowMeaning
covcov(A[,w]) / cov(x,y)landedCovariance matrix of A's columns (rows = observations); a vector gives its variance
corrcovcorrcov(C)landedThe correlation matrix of a covariance matrix, with exact ones on its diagonal; [R,sigma] adds the standard deviations it was scaled by
tiedranktiedrank(x)landedRanks down each column (along a row vector), ties taking the AVERAGE of the ranks they span. [r,tieadj] adds sum((t^3-t)/2) over the tie groups, which is the correction the rank tests need and 0 when nothing ties
regressregress(y,X[,alpha])landedLeast-squares fit of y on the design matrix X. ⚠ X is used EXACTLY as given -- an intercept is a column of ones you add: regress(y,[ones(n,1) X]). [b,bint,r,rint,stats] adds the coefficient intervals at 1-alpha (default 0.05), the residuals, their DELETED-error intervals, and the row [R2 F p s2]. A rank-deficient X is refused rather than zero-filled
pcapca(X[,name,value])landedPrincipal components of X by SVD of the centred data: [coeff,score,latent,tsquared,explained,mu]. Coefficient columns are sign-normalised so their largest entry is positive (MATLAB's rule, so both sides agree entry for entry); latent divides by n-1; explained sums to 100 even with "NumComponents" set; tsquared is Hotelling's T squared. Options: "Centered", "NumComponents"
pcacovpcacov(C)landedPrincipal components of a COVARIANCE matrix through its SVD: [coeff,latent,explained], with pca's sign convention
pcarespcares(X,ndim)landedWhat the first ndim principal components do NOT explain: the residuals, and [res,rec] the reconstruction beside them. ndim above the usable rank min(n-1,p) is clamped, as pcares.m clamps it
canoncorrcanoncorr(X,Y)landedCanonical correlations of two sets of columns measured on the same rows: [A,B,r,U,V]. r is unique and exact; A, B, U and V are determined only up to a per-column SIGN that canoncorr.m never fixes -- U(:,k) and V(:,k) always correlate at +r(k), which is the coupling that survives. A rank-deficient set is not refused: the deficient columns get explicit zero weight rows. The sixth output stats is a struct and is refused
cmdscalecmdscale(D[,p])landedClassical (metric) multidimensional scaling: the point configuration whose distances reproduce D. D is a square dissimilarity matrix, a similarity one (unit diagonal, nothing above 1 -- transformed by sqrt(1-D)), or pdist's row. [Y,e] adds the eigenvalue spectrum; ⚠ Y keeps only the columns with e > max(abs(e))*eps^(3/4), so size(Y,2) is not numel(e). Column signs follow cmdscale.m's rule, so both sides agree entry for entry
procrustesprocrustes(X,Y[,name,value])landedThe rotation, scaling and translation of Y that lands it closest to X, and the standardized residual d that is left. [d,Z] gives the fitted Y; the third output transform is a STRUCT and is refused. Options: "Scaling" (default true), "Reflection" ("best", true or false). Y may have fewer columns than X and is zero-padded
geomeangeomean(x[,dim])landedGeometric mean: exp(mean(log(x))), which is what geomean.m computes -- so a ZERO entry answers 0 and a negative one is an error, on both sides
harmmeanharmmean(x[,dim])landedHarmonic mean: 1./mean(1./x), literally. A zero entry answers 0 rather than dividing by zero, because the infinity happens inside the mean
trimmeantrimmean(x,percent[,flag][,dim])landedMean of x with percent/2 of the samples removed from each END. The flag chooses how a fractional trim count is settled: "round" (the default; round(k - eps(k)), so an exact half trims DOWN), "floor", or "weighted", which trims a fraction of a sample so exactly percent of the data is gone
tabulatetabulate(x)landedThe [value, count, percent] table of a numeric vector. On values that are all POSITIVE INTEGERS it lists every value from 1 to max(x), zero counts included -- tabulate([2 5 5 9]) is nine rows; on any other data it lists only the distinct values
crosstabcrosstab(x,y)landedContingency table of two grouping vectors: one row per distinct x, one column per distinct y, in ascending order, with an observation missing either variable dropped. [tbl,chi2,p] adds Pearson's statistic and its UPPER-tail p-value at (r-1)(c-1) degrees of freedom
grpstatsgrpstats(x,group)landedGroup means of x's rows, one output row per distinct group in ascending order. [m,sem,n] adds the standard error std(x,0,1)/sqrt(n) (0 for a group of one) and the group sizes. MATLAB's fourth output is a cell of labels, which this console has no kind for -- unique(group) is the same list
pdistpdist(X[,metric[,arg]])landedPairwise distances between the ROWS of X, as MATLAB's CONDENSED row of n(n-1)/2 values in the order (1,2),(1,3),...,(2,3),... Metrics: "euclidean" (default), "squaredeuclidean", "seuclidean", "cityblock", "minkowski" (arg is the exponent, default 2), "chebychev" (MATLAB's spelling), "cosine", "correlation", "hamming", "jaccard", "spearman", "mahalanobis". squareform turns the row into the symmetric matrix
pdist2pdist2(X,Y[,metric[,arg]])landedDistances from every row of X to every row of Y, as the full numel-rows-of-X by numel-rows-of-Y matrix. Same metric words as pdist; the standardized-Euclidean scale and the Mahalanobis covariance come from X alone. MATLAB's "Smallest" form is knnsearch here
squareformsquareform(v[,direction])landedThe condensed distance row as the symmetric matrix, or a symmetric matrix with a zero diagonal back as the row. The direction follows the SHAPE unless "tomatrix"/"tovector" says otherwise; a vector whose length is not n(n-1)/2, or a matrix with a non-zero diagonal, is an error rather than something reshaped to fit
mahalmahal(Y,X)landedThe SQUARED Mahalanobis distance of each row of Y from the sample X, one per row of Y -- through X's QR, as mahal.m does. Not pdist2(Y,X,"mahalanobis"), which is a distance between two points and not from a point to a sample
normpdfnormpdf(x[,mu[,sigma]])landedThe normal density at x with mean mu and deviation sigma, defaulting to the standard normal. A sigma at or below zero answers NaN on both sides rather than erroring.
norminvnorminv(p[,mu[,sigma]])landedThe normal quantile: the x whose cumulative probability is p. -sqrt(2)*erfcinv(2*p), scaled and shifted -- the same engine MATLAB's norminv uses, not a table.
normrndnormrnd(mu,sigma[,m[,n]])landedAn m by n draw from the normal distribution. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
normfitnormfit(x[,alpha])landed[muhat, sigmahat, muci, sigmaci] = the normal fit. sigmahat is the UNBIASED deviation (divided by n - 1), and the two intervals are exact rather than normal approximations -- a t interval for the mean and a chi-square interval for the deviation.
normlikenormlike([mu sigma],data)landedThe NEGATIVE log likelihood of the data under that mean and deviation, so a better fit is a SMALLER number. The parameters come first, as one two-element vector.
normstatnormstat(mu,sigma)landed[m, v] = the mean and VARIANCE of the normal distribution -- v is sigma^2, not sigma.
tpdftpdf(x,v)landedThe Student t density at x with v degrees of freedom.
tcdftcdf(x,v[,"upper"])landedThe Student t cumulative probability at x with v degrees of freedom; a trailing "upper" answers the upper tail exactly rather than 1 - p. Two arrangements of betainc, chosen on v < x^2 so that 1 is never the dominant term subtracted from (A&S 26.5.2); v = 1 is the Cauchy closed form.
tinvtinv(p,v)landedThe Student t quantile with v degrees of freedom. THREE methods for one function, as MATLAB's own has: the closed form at v = 1, a betaincinv pair below v = 1000, and a five-term Cornish-Fisher expansion above it.
trndtrnd(v[,m[,n]])landedAn m by n draw from the Student t distribution with v degrees of freedom. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
chi2pdfchi2pdf(x,v)landedThe chi-square density at x with v degrees of freedom. It IS gampdf(x, v/2, 2) on both sides.
chi2cdfchi2cdf(x,v[,"upper"])landedThe chi-square cumulative probability at x with v degrees of freedom: gammainc(x/2, v/2), the same engine gamcdf uses; a trailing "upper" answers the upper tail exactly rather than 1 - p.
chi2invchi2inv(p,v)landedThe chi-square quantile with v degrees of freedom: 2*gammaincinv(p, v/2), which is what gaminv(p, v/2, 2) is.
chi2rndchi2rnd(v[,m[,n]])landedAn m by n draw from the chi-square distribution with v degrees of freedom. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
fpdffpdf(x,v1,v2)landedThe F density at x with v1 numerator and v2 denominator degrees of freedom, written in logs with log1p on both halves as MATLAB's fpdf.m writes it.
fcdffcdf(x,v1,v2[,"upper"])landedThe F cumulative probability at x. Its UPPER tail is the LOWER tail of the reciprocal with the two degree-of-freedom counts swapped -- MATLAB's own route, and not 1 - p.
finvfinv(p,v1,v2)landedThe F quantile. Which side of the MEDIAN p falls on decides which betaincinv arrangement keeps its digits, which is why finv calls betainc before it calls betaincinv -- here as in MATLAB.
frndfrnd(v1,v2[,m[,n]])landedAn m by n draw from the F distribution. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
unifpdfunifpdf(x[,a,b])landedThe uniform density at x on [a,b]. Both ends come together: unifpdf(x) is the standard uniform on [0,1] and unifpdf(x,a,b) a general one -- the one-parameter form does not exist in MATLAB either.
unifcdfunifcdf(x[,a,b])landedThe uniform cumulative probability at x on [a,b]; a trailing "upper" answers the upper tail exactly rather than 1 - p.
unifinvunifinv(p[,a,b])landedThe uniform quantile on [a,b]: the x whose cumulative probability is p.
unifrndunifrnd(a,b[,m[,n]])landedAn m by n draw from the uniform distribution on [a,b]. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
unifstatunifstat(a,b)landed[m, v] = the mean and VARIANCE of the uniform distribution on [a,b].
unifitunifit(x[,alpha])landed[ahat, bhat, aci, bci] = the uniform fit: the two extremes, and an EXACT interval for each -- alpha^(1/n) is the probability that every draw fell inside a shrunk range.
exppdfexppdf(x[,mu])landedThe exponential density at x with MEAN mu. mu is the MEAN, not a rate: exppdf(x,2) is exp(-x/2)/2.
expcdfexpcdf(x[,mu])landedThe exponential cumulative probability at x with MEAN mu; a trailing "upper" answers the upper tail exactly rather than 1 - p.
expinvexpinv(p[,mu])landedThe exponential quantile with MEAN mu: the x whose cumulative probability is p.
exprndexprnd(mu[,m[,n]])landedAn m by n draw from the exponential distribution with MEAN mu. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
expstatexpstat(mu)landed[m, v] = the mean and VARIANCE of the exponential distribution with MEAN mu.
expfitexpfit(x[,alpha])landed[muhat, muci] = the exponential fit: the sample mean, with the EXACT gamma interval (the sum of n exponentials is Gamma(n, mu)), not a normal one.
poisspdfpoisspdf(x,lambda)landedThe Poisson density at x with mean lambda. The density is Loader's saddle point, not exp(-l)*l^x/x!, so it still has digits at l = 1000.
poisscdfpoisscdf(x,lambda)landedThe Poisson cumulative probability at x with mean lambda; a trailing "upper" answers the upper tail exactly rather than 1 - p.
poissinvpoissinv(p,lambda)landedThe Poisson quantile with mean lambda: smallest count whose cumulative probability reaches p.
poissrndpoissrnd(lambda[,m[,n]])landedAn m by n draw from the Poisson distribution with mean lambda. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
poisstatpoisstat(lambda)landed[m, v] = the mean and VARIANCE of the Poisson distribution with mean lambda.
poissfitpoissfit(x[,alpha])landed[lhat, lci] = the Poisson fit: the sample mean, with an interval that CHANGES METHOD at a total count of 100 -- exact chi-square below it, a normal approximation above.
binopdfbinopdf(x,n,p)landedThe binomial density at x of n trials at probability p. Above ten trials the density leaves nchoosek(n,x)*p^x*q^(n-x) for the same saddle point binopdf.m uses.
binocdfbinocdf(x,n,p)landedThe binomial cumulative probability at x of n trials at probability p; a trailing "upper" answers the upper tail exactly rather than 1 - p.
binoinvbinoinv(p,n,p)landedThe binomial quantile of n trials at probability p: smallest count whose cumulative probability reaches p.
binorndbinornd(n,p[,m[,n]])landedAn m by n draw from the binomial distribution of n trials at probability p. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
binostatbinostat(n,p)landed[m, v] = the mean and VARIANCE of the binomial distribution of n trials at probability p.
binofitbinofit(x,n[,alpha])landed[phat, pci] = the binomial fit of x successes in n trials: x/n, with the exact CLOPPER-PEARSON interval built out of finv. x = 0 pins the lower end at 0 and x = n the upper at 1.
gampdfgampdf(x,a[,b])landedThe gamma density at x of shape a and SCALE b. b is the SCALE (mean a*b), not a rate; the cdf IS gammainc(x/b,a) and the inverse IS gammaincinv(p,a)*b.
gamcdfgamcdf(x,a[,b])landedThe gamma cumulative probability at x of shape a and SCALE b; a trailing "upper" answers the upper tail exactly rather than 1 - p.
gaminvgaminv(p,a[,b])landedThe gamma quantile of shape a and SCALE b: the x whose cumulative probability is p.
gamrndgamrnd(a,b[,m[,n]])landedAn m by n draw from the gamma distribution of shape a and SCALE b. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
gamstatgamstat(a[,b])landed[m, v] = the mean and VARIANCE of the gamma distribution of shape a and SCALE b.
gamfitgamfit(x[,alpha])landed[parmhat, parmci] = the gamma fit: the data is divided by its own mean, the likelihood equation psi(a) - log(a) - const is bracketed, and MATLAB's own fzero solves it at TolX 1e-8 -- so what this answers is MATLAB's stopping point, not a better-converged root.
betapdfbetapdf(x,a,b)landedThe beta density at x of shapes a and b. The cdf IS betainc(x,a,b) and the inverse IS betaincinv(p,a,b); the four corners at x = 0 and 1 are each their own answer.
betacdfbetacdf(x,a,b)landedThe beta cumulative probability at x of shapes a and b; a trailing "upper" answers the upper tail exactly rather than 1 - p.
betainvbetainv(p,a,b)landedThe beta quantile of shapes a and b: the x whose cumulative probability is p.
betarndbetarnd(a,b[,m[,n]])landedAn m by n draw from the beta distribution of shapes a and b. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
betastatbetastat(a,b)landed[m, v] = the mean and VARIANCE of the beta distribution of shapes a and b.
lognpdflognpdf(x[,mu,sigma])landedThe lognormal density at x whose LOG is normal with mean mu and deviation sigma. mu and sigma describe log(x), not x; the variance is exp(2mu+s^2)*(exp(s^2)-1) and not sigma^2.
logncdflogncdf(x[,mu,sigma])landedThe lognormal cumulative probability at x whose LOG is normal with mean mu and deviation sigma; a trailing "upper" answers the upper tail exactly rather than 1 - p.
logninvlogninv(p[,mu,sigma])landedThe lognormal quantile whose LOG is normal with mean mu and deviation sigma: the x whose cumulative probability is p.
lognrndlognrnd(mu,sigma[,m[,n]])landedAn m by n draw from the lognormal distribution whose LOG is normal with mean mu and deviation sigma. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
lognstatlognstat(mu,sigma)landed[m, v] = the mean and VARIANCE of the lognormal distribution whose LOG is normal with mean mu and deviation sigma.
lognfitlognfit(x[,alpha])landed[parmhat, parmci] = the lognormal fit, which IS normfit on log(x): parmhat is a 1 by 2 of [mu sigma] and parmci a 2 by 2, with the exact t and chi-square intervals.
wblpdfwblpdf(x[,A,B])landedThe Weibull density at x of SCALE A and SHAPE B. MATLAB's order is (scale, shape) -- the reverse of the (k, lambda) most texts write.
wblcdfwblcdf(x[,A,B])landedThe Weibull cumulative probability at x of SCALE A and SHAPE B; a trailing "upper" answers the upper tail exactly rather than 1 - p.
wblinvwblinv(p[,A,B])landedThe Weibull quantile of SCALE A and SHAPE B: the x whose cumulative probability is p.
wblrndwblrnd(A,B[,m[,n]])landedAn m by n draw from the Weibull distribution of SCALE A and SHAPE B. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
wblstatwblstat(A,B)landed[m, v] = the mean and VARIANCE of the Weibull distribution of SCALE A and SHAPE B.
wblfitwblfit(x[,alpha])landed[parmhat, parmci] = the Weibull fit, which IS evfit on log(x) read back through exp and a reciprocal -- and the reciprocal SWAPS the two ends of the shape's interval.
raylpdfraylpdf(x[,b])landedThe Rayleigh density at x of scale b.
raylcdfraylcdf(x[,b])landedThe Rayleigh cumulative probability at x of scale b; a trailing "upper" answers the upper tail exactly rather than 1 - p.
raylinvraylinv(p[,b])landedThe Rayleigh quantile of scale b: the x whose cumulative probability is p.
raylrndraylrnd(b[,m[,n]])landedAn m by n draw from the Rayleigh distribution of scale b. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
raylstatraylstat(b)landed[m, v] = the mean and VARIANCE of the Rayleigh distribution of scale b.
raylfitraylfit(x[,alpha])landed[bhat, bci] = the Rayleigh fit: sqrt(mean(x.^2)/2), with a chi-square interval on 2n degrees of freedom.
evpdfevpdf(x[,mu,sigma])landedThe extreme-value density at x of location mu and scale sigma. This is the SMALLEST-extreme (Gumbel minimum) family, which is what MATLAB's ev* names mean: its mean is mu MINUS Euler's constant times sigma.
evcdfevcdf(x[,mu,sigma])landedThe extreme-value cumulative probability at x of location mu and scale sigma; a trailing "upper" answers the upper tail exactly rather than 1 - p.
evinvevinv(p[,mu,sigma])landedThe extreme-value quantile of location mu and scale sigma: the x whose cumulative probability is p.
evrndevrnd(mu,sigma[,m[,n]])landedAn m by n draw from the extreme-value distribution of location mu and scale sigma. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
evstatevstat(mu,sigma)landed[m, v] = the mean and VARIANCE of the extreme-value distribution of location mu and scale sigma.
evfitevfit(x[,alpha])landed[parmhat, parmci] = the extreme-value fit: shift, scale, bracket, then MATLAB's fzero at TolX 1e-6. Its location has a closed form once the scale is known, which is why this fit exists here and gevfit does not.
gevpdfgevpdf(x[,k,sigma,mu])landedThe generalized extreme-value density at x of SHAPE k, scale sigma and location mu. The shape comes FIRST; \|k\| < eps is the Gumbel limit; outside the support the cdf is 0 or 1 by the sign of k.
gevcdfgevcdf(x[,k,sigma,mu])landedThe generalized extreme-value cumulative probability at x of SHAPE k, scale sigma and location mu; a trailing "upper" answers the upper tail exactly rather than 1 - p.
gevinvgevinv(p[,k,sigma,mu])landedThe generalized extreme-value quantile of SHAPE k, scale sigma and location mu: the x whose cumulative probability is p.
gevrndgevrnd(k,sigma,mu[,m[,n]])landedAn m by n draw from the generalized extreme-value distribution of SHAPE k, scale sigma and location mu. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
gevstatgevstat(k,sigma,mu)landed[m, v] = the mean and VARIANCE of the generalized extreme-value distribution of SHAPE k, scale sigma and location mu.
gppdfgppdf(x[,k,sigma,theta])landedThe generalized Pareto density at x of SHAPE k, scale sigma and threshold theta. The shape comes first; \|k\| < eps is the exponential limit; a negative k gives a bounded support.
gpcdfgpcdf(x[,k,sigma,theta])landedThe generalized Pareto cumulative probability at x of SHAPE k, scale sigma and threshold theta; a trailing "upper" answers the upper tail exactly rather than 1 - p.
gpinvgpinv(p[,k,sigma,theta])landedThe generalized Pareto quantile of SHAPE k, scale sigma and threshold theta: the x whose cumulative probability is p.
gprndgprnd(k,sigma,theta[,m[,n]])landedAn m by n draw from the generalized Pareto distribution of SHAPE k, scale sigma and threshold theta. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
gpstatgpstat(k,sigma[,theta])landed[m, v] = the mean and VARIANCE of the generalized Pareto distribution of SHAPE k, scale sigma and threshold theta.
nbinpdfnbinpdf(x,r,p)landedThe negative binomial density at x of r successes at probability p. r may be any positive real, not a whole count; the upper cdf is a betainc and the lower one a sum of densities, and neither is one minus the other.
nbincdfnbincdf(x,r,p)landedThe negative binomial cumulative probability at x of r successes at probability p; a trailing "upper" answers the upper tail exactly rather than 1 - p.
nbininvnbininv(p,r,p)landedThe negative binomial quantile of r successes at probability p: smallest count whose cumulative probability reaches p.
nbinrndnbinrnd(r,p[,m[,n]])landedAn m by n draw from the negative binomial distribution of r successes at probability p. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
nbinstatnbinstat(r,p)landed[m, v] = the mean and VARIANCE of the negative binomial distribution of r successes at probability p.
geopdfgeopdf(x,p)landedThe geometric density at x at probability p. It counts FAILURES before the first success, so the support starts at 0.
geocdfgeocdf(x,p)landedThe geometric cumulative probability at x at probability p; a trailing "upper" answers the upper tail exactly rather than 1 - p.
geoinvgeoinv(p,p)landedThe geometric quantile at probability p: smallest count whose cumulative probability reaches p.
georndgeornd(p[,m[,n]])landedAn m by n draw from the geometric distribution at probability p. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
geostatgeostat(p)landed[m, v] = the mean and VARIANCE of the geometric distribution at probability p.
hygepdfhygepdf(x,M,K,N)landedThe hypergeometric density at x drawing N from a population of M holding K successes.
hygecdfhygecdf(x,M,K,N)landedThe hypergeometric cumulative probability at x drawing N from a population of M holding K successes; a trailing "upper" answers the upper tail exactly rather than 1 - p.
hygeinvhygeinv(p,M,K,N)landedThe hypergeometric quantile drawing N from a population of M holding K successes: smallest count whose cumulative probability reaches p.
hygerndhygernd(M,K,N[,m[,n]])landedAn m by n draw from the hypergeometric distribution drawing N from a population of M holding K successes. A DRAW: MATLAB's stream is a Mersenne Twister and this console's is not, so the same seed gives different numbers and no seed makes them agree.
hygestathygestat(M,K,N)landed[m, v] = the mean and VARIANCE of the hypergeometric distribution drawing N from a population of M holding K successes.
pdfpdf(name, x[, a, b, c])landedThe density of a distribution named as a STRING. ⚠ A parameter left off is ZERO here and the family's default in the named form, so pdf("normal", 1) is NaN where normpdf(1) is 0.2420 -- MATLAB's own behaviour. The name is a unique case-insensitive PREFIX: "norm" works, "g" is ambiguous
randomrandom(name, p1, ..., pk[, m[, n]])landedA draw from a named distribution. ⚠ Unlike pdf/cdf/icdf this does NOT fill omitted parameters with zero: it forwards them, so random("normal") is an error on both sides. A DRAW: MATLAB's stream is not this console's
nlinfitnlinfit(X,y,modelfun,beta0)landed[beta, R, J, CovB, MSE] = the nonlinear least-squares fit of a model HANDLE taking (beta, X), by Levenberg-Marquardt. ⚠ Its answer is a stopping POINT: it halts at TolX 1e-8 on the step or TolFun 1e-8 on the relative change in the sum of squares, and this runs MATLAB's own iteration rather than solving the problem another way. The J it returns is built at the coefficients BEFORE the final step, which is what MATLAB returns too
nlparcinlparci(beta,resid,"covar"|"jacobian",M[,"alpha",a])landedci = a confidence interval per coefficient: a standard error times tinv on n - p degrees of freedom. ⚠ The errors are the ROW sums of squares of R inverse, not the column sums; the two differ for every coefficient but the last
ridgeridge(y,X,k[,scaled])landedb = one column of ridge coefficients per entry of k, from the augmented least squares [Z; sqrt(k)I] \\ [y; 0]. ⚠ THE DEFAULT ANSWER IS NOT ON THE DATA'S SCALE AND HAS NO INTERCEPT: ridge(y,X,k) and ridge(y,X,k,1) both answer p coefficients for the centred and SCALED design, and only ridge(y,X,k,0) divides them back by the column deviations and prepends mean(y) - mx*b, giving p+1. ⚠ It scales by the SAMPLE deviation, std(X,0,1), where lasso uses the population one
plsregress[XL,YL,XS,YS,beta,pctVar,MSE]=plsregress(X,Y[,ncomp])landedSIMPLS partial least squares: ncomp components, min(n-1,size(X,2)) of them by default. beta is (size(X,2)+1) by size(Y,2) with the intercept in its first ROW. ⚠ THE FIRST FOUR OUTPUTS ARE ONLY DETERMINED UP TO A PER-COMPONENT SIGN -- simpls takes the leading singular vectors of X'*Y and applies no sign convention, unlike pca -- so they may come back negated against MATLAB's while beta, pctVar and MSE, which are all products of two flipped things, agree exactly. The stats struct is refused
cophenetcophenet(Z,Y)landedThe cophenetic correlation coefficient of the tree Z against the condensed distance row Y it was built from -- how faithfully the tree keeps the distances. [c,d] = cophenet(Z,Y) also answers the cophenetic distances themselves, in Y's order
inconsistentinconsistent(Z[,depth])landedThe (n-1) by 4 inconsistency table of the tree Z: the mean and the standard deviation of the link heights within depth levels below each link (2 by default), how many links that was, and the inconsistency coefficient. A link with one link under it has deviation 0 and coefficient 0, not a NaN
kmeanskmeans(X,k,"Start",C[,"Distance",d][,"MaxIter",n])landedLloyd's algorithm from the starting centres C, one row per cluster: [idx,C,sumd,D] = kmeans(...). Each of the five metric words carries its OWN centre -- "sqeuclidean" the mean, "cityblock" the median, "cosine" and "correlation" the unnormalized mean of the normalized rows, "hamming" the majority. A point moves only when the new distance is strictly smaller, so a tie leaves it where it is. Without a "Start" MATLAB draws its centres from its own random stream and the answer could not be compared, so this console refuses that form
kmedoidskmedoids(X,k,"Start",C[,"Distance",d])landedThe same question with the centre required to BE one of the points: PAM's swap phase from the starting medoids, [idx,C,sumd,D,midx] = kmedoids(...). Every row of C must be a row of X. Deterministic given the start, which is why this arm is comparable and the unstarted one is not
silhouettesilhouette(X,idx[,metric])landedOne silhouette value per row of X, between -1 and 1: how much closer a point is to its own cluster than to the nearest other one. The default metric is SQUARED Euclidean, not Euclidean. A point alone in its cluster scores exactly 1
anova1anova1(y[,group])landedOne-way analysis of variance over the COLUMNS of y, or over a vector split by a grouping vector. Answers the p-value; MATLAB's table is a cell and its stats a struct, and both are refused
anova2anova2(y[,reps])landedTwo-way analysis of variance, rows one factor and columns the other. Answers MATLAB's row of p-values: the column effect, the row effect, and with more than one replicate the interaction. With one replicate there is nothing to separate interaction from error, so there are two p-values and not three
kruskalwalliskruskalwallis(y[,group])landedanova1 on the tied RANKS with a chi-square in place of the F -- which is literally how kruskalwallis.m is written, one line forwarding to anova1. Answers the p-value
friedmanfriedman(y[,reps])landedThe rank analogue of anova2: ranks WITHIN each block, then reads a chi-square off the column sum of squares. A NaN is refused rather than dropped, because a block with a missing value has no complete ranking
multcomparemultcompare(stats)landedRefused: its INPUT is the stats STRUCT the four analyses answer as their third output, and this console cannot make one (T0.6) -- a call that cannot be spelled here rather than an output that is missing
kstestkstest(x[,"Alpha",a][,"Tail",t])landedOne-sample Kolmogorov-Smirnov against the STANDARD normal -- kstest does not standardize x for you: [h,p,ksstat,cv] = kstest(...). The two-sided p is exact below MATLAB's threshold on n*D^2 (Marsaglia, Tsang and Wang's matrix-power formula) and asymptotic above it
kstest2kstest2(x1,x2[,"Alpha",a][,"Tail",t])landedTwo-sample Kolmogorov-Smirnov: [h,p,ks2stat] = kstest2(...). The p-value is the asymptotic Kolmogorov series on lambda with Stephens' small-sample correction
lillietestlillietest(x[,"Distribution",d][,"Alpha",a])landedKolmogorov-Smirnov against a distribution whose parameters were ESTIMATED FROM THE SAME DATA -- "normal" (default), "exponential" or "ev" -- so its null distribution is tabulated rather than computed: [h,p,kstat,critval]. A p beyond the table clamps to 0.001 or 0.5, which means "at most" or "at least"
adtestadtest(x[,"Distribution",d][,"Alpha",a])landedAnderson-Darling, which weights the TAILS where kstest weights the middle: [h,p,adstat,cv]. Families "norm" (default), "exp", "ev", "logn" and "weibull" -- the last two are the first and the third on log(x). Its table is interpolated in LOG alpha and clamps at 0.0005 and 0.99
jbtestjbtest(x[,alpha])landedJarque-Bera: skewness and kurtosis together, [h,p,jbstat,critval]. The table is 33 sample sizes by 17 alphas, interpolated in 1/n first and then in alpha, and clamps at 0.001 and 0.5
mvnpdfmvnpdf(X[,Mu[,Sigma]])landedThe multivariate normal density at each ROW of X, as a column. Mu may be one row or one per row of X; Sigma may be the full covariance or, given as a 1 by d ROW, its diagonal -- the shape decides, so a 1 by d Sigma is never read as a covariance. Goes through the Cholesky factor, never an inverse
mvncdfmvncdf(X[,mu,Sigma]) | mvncdf(XL,XU,mu,Sigma)landedThe multivariate normal probability below each row of X, or inside the box XL..XU, as a column. Exact in one dimension, on a diagonal Sigma in any dimension, and in two dimensions (Gauss-Legendre quadrature, as internal.stats.bvncdf). Above two CORRELATED dimensions MATLAB integrates with a randomized rule whose answer moves from call to call, and this console refuses rather than answer a number nothing can compare
mvtpdfmvtpdf(X,C,df)landedThe multivariate Student t density at each ROW of X, as a column. C is a CORRELATION matrix: a covariance handed here has its scale divided out first, exactly as mvtpdf.m divides it, so mvtpdf(x,[4 2;2 4],5) and mvtpdf(x,[1 .5;.5 1],5) answer the same number
mvnrndmvnrnd(mu,Sigma[,n])landedn rows drawn from the multivariate normal. A DRAW: its numbers cannot be compared with MATLAB's, whose generator is a different stream
mvtrndmvtrnd(C,df[,n])landedn rows drawn from the multivariate t. A draw; see mvnrnd
wishrndwishrnd(Sigma,df)landedOne draw from the Wishart distribution, through Bartlett's decomposition. A draw; see mvnrnd
iwishrndiwishrnd(Tau,df)landedOne draw from the inverse Wishart distribution. A draw; see mvnrnd
classifyclassify(sample,training,group[,type[,prior]])landedDiscriminant analysis, the one classifier MATLAB ships without an object: [class,err,posterior,logp] = classify(...). The type is "linear" (one pooled covariance, the default), "quadratic" (one per group), "diaglinear", "diagquadratic" or "mahalanobis" -- and the Mahalanobis rule carries no posterior on either side. err is a RESUBSTITUTION error weighted by the prior, not the misclassified fraction
confusionmatconfusionmat(g,ghat[,"Order",order])landedThe confusion matrix, rows the true class and columns the predicted one. [C,order] also answers the class list, which is the sorted union of both label vectors -- so a class that was never predicted still gets a row and a column. A label left out of an explicit "Order" is left out of the counts
perfcurveperfcurve(labels,scores,posclass[,"XCrit",x][,"YCrit",y])landedA performance curve: [X,Y,T,AUC] = perfcurve(...). The first point is (0,0) with the highest score REPEATED as its threshold, tied scores are one point rather than one per observation, and the criteria are "tpr", "fpr", "fnr", "tnr", "ppv", "npv" and "accu" with MATLAB's synonyms. AUC is the trapezoid area under the curve as returned
randsamplerandsample(n,k[,replace[,w]])landedk values drawn from 1..n, or from a population vector. WITHOUT replacement by default -- the opposite of datasample, which is MATLAB's own inconsistency
ttestttest(x[, m]) / ttest(x, y) / [h, p, ci] = ttest(...)landedOne-sample or PAIRED t-test -- ⚠ two vectors means PAIRED here and unpaired in ttest2. Options "Alpha" (0.05) and "Tail" ("both"); a one-sided interval is half-infinite
ztestztest(x, m, sigma) / [h, p, ci] = ztest(...)landedThe test of a mean with a KNOWN standard deviation, so the statistic is normal and there are no degrees of freedom to spend

Symbolic Math Toolbox#

Row says whether the name is here as a landed row — MATLAB's name, answered MATLAB's way — or as an extra: the console's own, carried ahead of the row that lands MATLAB's form of it, so what a pasted MATLAB call means under that name is not yet settled.

FunctionSignatureRowMeaning
divisorsdivisors(n)landedEvery POSITIVE divisor of n, ascending, as a row. The sign of n is ignored and divisors(0) is 0, both MATLAB's. ⚠ On a SYMBOLIC polynomial (T4.18) it is every product of the factors instead, unexpanded and with the numeric content dropped: divisors(x^2 - 1) is [1, x - 1, x + 1, (x - 1)*(x + 1)] and divisors(2*x) is [1, x]
str2symstr2sym("expr")landedRead a symbolic expression from text. A decimal literal STAYS a decimal here, as it does in MATLAB (str2sym('0.5') is 0.5 where sym(0.5) is 1/2)
symvarsymvar(f[,1])landedThe free variables of an expression, alphabetically; symvar(f, 1) is the one CLOSEST TO x, and the tie goes to the letter after x -- symvar(w + y, 1) is y and symvar(w + z, 1) is w
expandexpand(f[,"ArithmeticOnly",true])landedDistribute products over sums, open integer powers of sums, and apply the addition formulas for sin, cos and exp. MATLAB writes a multiple angle in cosines alone, so expand(cos(2*x)) is 2*cos(x)^2 - 1; 'ArithmeticOnly' keeps the arithmetic half only
simplifysimplify(f)landedRational normalisation with gcd cancellation, the Pythagorean identity, cos^2 - sin^2 -> cos(2x) and the exp/log inverse, searched with the smallest result kept. What it cannot reduce comes back unchanged, which is MATLAB's contract too -- simplify(sqrt(x^2)) stays (x^2)^(1/2), because x could be negative (assumptions are not landed)
collectcollect(f[,x])landedGather like powers of x, coefficients kept symbolic: collect(a*x + b*x + c, x) is x*(a + b) + c
combinecombine(f,target)landedThe inverse of expand for one family: "exp" (exp(a)*exp(b) -> exp(a + b)) and "sincos" (2*sin(u)*cos(u) -> sin(2*u)). "log" combines nothing without a positivity assumption -- which is what MATLAB does too
numden[n,d]=numden(f)landedThe expression over a common denominator, split, with the common factor cancelled: numden(1/x + 1/y) is (x + y) over x*y
adjointadjoint(A)landedThe adjugate: the transposed cofactor matrix, so adjoint(A)/det(A) is inv(A). Symbolic matrices only (T4.13)
charpolycharpoly(A[,x])landedThe characteristic polynomial: a coefficient ROW without a variable, the polynomial in x with one. Symbolic matrices only (T4.13)
limitlimit(f[,x],a[,"left"|"right"])landedThe limit of f as x approaches a. Substitution where f is continuous, a removable singularity by cancellation, the ratio of two series where both vanish (sin(x)/x is 1), and at Inf the degrees of a rational function, exp > any power > log, and (1 + 1/x)^x. ⚠ A two-sided limit that disagrees with itself is NaN -- limit(1/x, x, 0) -- and the one-sided forms answer -Inf and Inf (T4.6)
symsumsymsum(f[,k][,a,b])landedThe sum of f over k. Numeric bounds are evaluated; a symbolic bound closes a polynomial sum; an infinite bound answers 1/k^2, 1/k^4, 1/k^6, the divergent 1/k, a geometric series with a numeric ratio, and x^k/k!. ⚠ With no bounds it is the ANTIDIFFERENCE -- symsum(k) is k^2/2 - k/2, the sum from 1 to k - 1 (T4.7)
symprodsymprod(f[,k][,a,b])landedThe product of f over k: numeric bounds, a body free of the index (a^n), or the index itself (factorial(n)) (T4.7)
vpasolvevpasolve(eqn[,x])landedsolve's answer as digits. A complex root is refused: this console's vpa has real decimal arithmetic and no complex form (T4.8)
heavisideheaviside(x)landedThe unit step. ⚠ heaviside(0) is 0.5, not 0 or 1 -- MATLAB's documented convention. Works on numbers and on symbols; diff(heaviside(x)) is dirac(x) (T4.16)
kroneckerDeltakroneckerDelta(m[,n])landed1 where the two arguments are equal and 0 where they differ, kept symbolic while they are. It stores the DIFFERENCE, so kroneckerDelta(m, n) prints as kroneckerDelta(m - n, 0) -- MATLAB's own form (T4.16)
piecewisepiecewise(cond,val[,cond,val][,otherwise])landedA value chosen by conditions: piecewise(x < 0, -x, x) is \|x\| written out. A trailing value with no condition is the otherwise-case and prints under MATLAB's symtrue marker. subs picks the branch; diff and int map over them (T4.16)
assumeassume(x,"real") / assume(x>0)landedConstrain a symbol: "real", "positive", "integer", "rational", a relation, or "clear" to forget. simplify, diff and isAlways all read it -- simplify(sqrt(x^2)) is abs(x) for a real x and x for a positive one. ⚠ MATLAB prints nothing here and this console has no valueless answer, so it answers the symbol it constrained; end the line with ';' to silence it (T4.15)
assumeAlsoassumeAlso(x>2)landedThe same, ADDING to what is already assumed rather than replacing it (T4.15)
assumptionsassumptions[(x)]landedWhat is assumed, in MATLAB's own spelling -- in(x, 'real') for a class and 0 < x for a bound. ⚠ Answers a STRING here where MATLAB answers a sym row: in(x, 'real') is a call this engine has no node for (T4.15)
isAlwaysisAlways(cond)landedIs the condition true for every value the assumptions allow? ⚠ Different from logical(cond), which asks whether the two sides are the SAME EXPRESSION: isAlways((x+1)^2 == x^2+2*x+1) is true and logical of it is false, on both sides. A condition it cannot prove is false, which is MATLAB's answer too (T4.15)
simplifyFractionsimplifyFraction(f[,"Expand",tf])landedThe expression as one fraction in lowest terms: numerator and denominator over a common denominator with their gcd cancelled. 'Expand' is true by default, which is MATLAB's own default, and multiplies the result out
partfracpartfrac(f[,x])landedThe partial-fraction expansion of a rational function, EXACT over the rationals (the rational roots with their multiplicities, then a linear system solved in exact arithmetic). A factor with no rational root keeps its quadratic term
coeffs[c,t]=coeffs(p[,x][,"All"])landedThe coefficients of a polynomial and their terms, DESCENDING -- coeffs(2*x^3 + 5*x, x) is [2, 5] with [x^3, x], and only the non-zero ones. "All" keeps the zeros
rewriterewrite(f,target)landedRewrite to "exp" (Euler's formulas -- this console's tree carries the imaginary unit), "sincos" or "sqrt"
hornerhorner(p[,x])landedThe nested form: horner(x^2 + 3*x + 1) is x*(x + 3) + 1
prettypretty(f)landedThe 2-D layout of an expression, with raised exponents and fractions over a rule. MATLAB PRINTS it and answers nothing; this console answers the layout as text, so disp(pretty(f)) shows what a MATLAB session shows
subssubs(f,old,new)landedSubstitute. ⚠ The answer is a SYM and not a double -- subs(x^2, x, 2) is sym(4), and double() is what converts it -- and a double replacement goes through the 'r' rule first, so subs(x^2, x, 0.5) is 1/4. subs(f) alone substitutes every free variable the WORKSPACE knows
vpavpa(f[,d])landedVariable precision: every exact number replaced by a decimal of d significant figures (d defaults to digits, 32). Rationals, pi, e, powers and square roots are evaluated EXACTLY, so vpa(pi, 40) is 40 correct digits. ⚠ A transcendental of a number beyond 16 digits is REFUSED (vpa(sin(2), 32)): sin is evaluated in double precision here, and printing 32 digits of a 17-digit answer would be a lie
digitsdigits[(d)]landedRead or set the precision vpa uses when it is not told. 32 by default, as in MATLAB
intint(f[,x][,a,b])landedThe integral: indefinite, or definite between two limits. Polynomials, rational functions (through exact partial fractions), the elementary antiderivatives, f(a*x + b), integration by parts against x^n, and sin^2/cos^2. ⚠ Beyond that the answer is the UNEVALUATED int(f(x), x) -- which is what MATLAB answers when its own engine cannot -- never a wrong closed form. An infinite limit is taken as the limit of the antiderivative where this console can see it
finversefinverse(f[,x])landedThe y with f(y) = x, written in x. Built on solve, so its SCOPE is that row's: polynomials, x^n = c in radicals, rational equations, and an elementary function peeled off one step at a time. ⚠ AN INVERSE IS NOT UNIQUE AND ONE BRANCH IS TAKEN -- finverse(x^2) is x^(1/2), not the pair, which is MATLAB's answer too (T4.17)
composecompose(f,g[,x[,y]])landedf with its variable replaced by g -- symvar(f, 1) unless x names it. The result is SIMPLIFIED, so compose(exp(x), log(y)) is y on both sides. MATLAB's fourth argument names the variable g is written in and changes nothing unless g is being renamed (T4.17)
dsolvedsolve(eqn[,cond,...])landedSolve a differential equation written over a symbolic function -- syms y(t) first, then dsolve(diff(y, t) == a*y). SCOPE: first order LINEAR with any coefficient (the integrating factor), second order linear with CONSTANT coefficients (the characteristic polynomial, all three root cases), a constant forcing term, and initial conditions including subs(diff(y, t), t, 0) == 0. ⚠ The arbitrary constants are C1 and C2, and their SIGN is each engine's own -- MATLAB writes C1*cos(t) - C2*sin(t) where this writes C1*cos(t) + C2*sin(t), the same family. Everything outside the scope refuses by name (T4.9)
laplacelaplace(f[,var][,transVar])landedThe Laplace transform. The table is c*t^n*exp(a*t)*{1, sin, cos, sinh, cosh}(w*t), the fractional power t^p through gamma(p+1)/s^(p+1), and the two singular rows heaviside(t-a) and dirac(k, t-a). The t^n factor is the n-th DERIVATIVE of the base row rather than a table entry, so laplace(t*cos(w*t)) is MATLAB's own 2*s^2/(s^2+w^2)^2 - 1/(s^2+w^2). ⚠ Term by term: a term outside the table comes back as the UNEVALUATED laplace(f, t, s), which is what MATLAB answers too, so laplace(t + g(t)) is 1/s^2 + laplace(g(t), t, s). ⚠ The default variables are a RULE -- t to s, but symvar(f,1) when there is no t, and the target moves to z when the source IS s (T4.10)
ilaplaceilaplace(F[,var][,transVar])landedThe inverse Laplace transform of a RATIONAL F: exact partial fractions over the rational poles, so c/(s-r)^k becomes c*t^(k-1)*exp(r*t)/(k-1)! and an irreducible quadratic becomes the exp*cos/exp*sin pair (or exp*cosh/exp*sinh when the roots are real and irrational). The polynomial part is the impulse train -- ilaplace(1) is dirac(t) and ilaplace(s) is dirac(1,t) -- and exp(-a*s)*G(s) is the second shift, heaviside(t-a)*g(t-a). ⚠ A REPEATED irreducible quadratic (1/(s^2+1)^2) is not in this table and comes back unevaluated; MATLAB answers it (T4.10)
ztransztrans(f[,var][,transVar])landedThe z-transform. The table is c*n^k*r^n*{1, sin, cos, sinh, cosh}(w*n), with exp(a*n) read as r = exp(a). r^n is the modulation property F(z/r) rather than a second table, and n^k is (-z d/dz) applied k times -- so ztrans(n^2) is MATLAB's z*(z+1)/(z-1)^3 without a row of its own. A term outside the table comes back as the unevaluated ztrans(f, n, z). Defaults n to z, symvar(f,1) when there is no n, and z to w when the source IS z (T4.10)
iztransiztrans(F[,var][,transVar])landedThe inverse z-transform of a RATIONAL F with rational poles. ⚠ EVERY answer carries a kroneckerDelta CORRECTION and it is not decoration: c/(z-r)^k is c*r^(n-k)nchoosek(n-1,k-1) plus c(-1)^k/r^k*kroneckerDelta(n,0), because the closed form does not vanish at n = 0. That is why iztrans(1/(z-2)) is 2^n/2 - kroneckerDelta(n,0)/2 and iztrans(z/(z-1)) is the plain 1 -- both MATLAB's answers. A POSITIVE power of z is anticausal and comes back unevaluated, which is what MATLAB does too; an irreducible quadratic (complex poles) does the same here and does not there (T4.10)
fourierfourier(f[,var][,transVar])landedThe Fourier transform, MATLAB's convention: F(w) = int f(x)*exp(-1i*w*x) dx over the whole line. The table is 1, exp(-A*x^2 + B*x + c) with A > 0, exp(-a*abs(x)), heaviside(x - b) with or without exp(-a*x), dirac(k, x - b), sign(x) and abs(x), 1/(p*x^2 + q), 1/x and sin(b*x)/x; x^n is 1i^n times the n-th DERIVATIVE in w, and cos(b*x), sin(b*x) and exp(1i*m*x) are the modulation shifts. So fourier(exp(-x^2)) is pi^(1/2)*exp(-w^2/4) and fourier(cos(3*x)) is pi*dirac(w + 3) + pi*dirac(w - 3). ⚠ A condition the engine cannot PROVE -- a > 0 for a symbolic a -- leaves the term unevaluated: assume it first. ⚠ Term by term, and a term outside the table comes back as the UNEVALUATED fourier(f, x, w). Defaults x to w, symvar(f,1) when there is no x, and the target moves to v when the source IS w (T4.10)
ifourierifourier(F[,var][,transVar])landedThe inverse Fourier transform, f(x) = int F(w)*exp(1i*w*x) dw/(2*pi). It is the forward table read back through ifourier(F)(x) = fourier(F)(-x)/(2*pi), so ifourier(exp(-w^2)) is exp(-x^2/4)/(2*pi^(1/2)) and ifourier(cos(w)) is dirac(x + 1)/2 + dirac(x - 1)/2. A term the forward table does not know comes back as the unevaluated ifourier(F, w, x) -- 1/(1 + 1i*w) is one: MATLAB answers it, this console does not yet. Defaults w to x, and to t when the source IS x (T4.10)
jacobianjacobian(f[,v])landedOne row per function, one column per variable; symvar's order when the variables are not given
hessianhessian(f[,v])landedThe matrix of second derivatives of a scalar expression
laplacianlaplacian(f[,v])landedThe sum of the second derivatives -- the SYMBOLIC Laplacian. The discrete one over numbers is del2
poly2sympoly2sym(c[,x])landedA coefficient row (highest power first) as a symbolic polynomial; the console's own polynomial value is accepted too
sym2polysym2poly(p)landedThe coefficients of a symbolic polynomial in ONE variable, highest power first, as plain numbers
matlabFunctionmatlabFunction(f[,"Vars",[x y]])landedThe expression as a console function HANDLE, in MATLAB's elementwise spelling -- matlabFunction(x^2 + 1) is @(x)x.^2+1.0, with the arguments in symvar's order unless 'Vars' says otherwise
latexlatex(f)landedThe expression in LaTeX, in MATLAB's own spelling: \\frac{1}{x}, \\sqrt{x}, \\mathrm{atan}\\left(x\\right)
symgradsymgrad("expr",x0)extraCentral-difference gradient of a scalar expression (vars x1..xn) at x0 -- the console's own, which held the name gradient until C8.18

Optimization Toolbox#

Row says whether the name is here as a landed row — MATLAB's name, answered MATLAB's way — or as an extra: the console's own, carried ahead of the row that lands MATLAB's form of it, so what a pasted MATLAB call means under that name is not yet settled.

FunctionSignatureRowMeaning
optimgetoptimget(opts,"Name"[,default])landedOne option read back out of an optimset or optimoptions value; [] when it was never set, or the default given as a third argument -- never the solver's own default, which is MATLAB's rule too
fminuncfminunc(f,x0) / [x,fval] = fminunc(f,x0) / [x,fval,exitflag] = fminunc(f,x0)landedThe minimiser of f from x0 by MATLAB's quasi-Newton BFGS with finite-difference gradients (Optimization Toolbox). exitflag carries MATLAB's integers: 1 a small gradient, 2 a small step, 5 no further reduction, 0 out of budget
fminimaxfminimax(F,x0[,A,b,Aeq,beq,lb,ub])landedThe x that minimises the LARGEST entry of F(x), subject to the linear constraints (Optimization Toolbox). Solved as the epigraph programme min t subject to F_i(x) <= t, linearised and re-solved until the step is interior -- so an AFFINE F is answered exactly by one linear programme. [x, fval, maxfval] = fminimax(...) also answers F there and the largest of it
fgoalattainfgoalattain(F,x0,goal,weight[,A,b,Aeq,beq,lb,ub])landedThe x whose objectives come closest to goal, trading them off by weight: min gamma subject to F_i(x) - w_i*gamma <= goal_i. A weight of ZERO makes that goal a HARD constraint rather than an ignored one. [x, fval, attainfactor] = fgoalattain(...) also answers F there and how far the goals were over- or under-attained
fsolvefsolve(F,x0) / [x,fval] = fsolve(F,x0) / [x,fval,exitflag] = fsolve(F,x0)landedA solution of the SQUARE system F(x) = 0 from x0, by MATLAB's trust-region dogleg with a finite-difference Jacobian (Optimization Toolbox). fval is the residual there
lsqnonlinlsqnonlin(F,x0) / [x,resnorm,residual,exitflag] = lsqnonlin(F,x0)landedThe x that minimises the sum of squares of the RESIDUAL vector F(x) answers, from x0, by MATLAB's trust-region-reflective (Optimization Toolbox). F answers the residuals themselves, never their sum of squares
lsqcurvefitlsqcurvefit(F,x0,xdata,ydata) / [x,resnorm,residual,exitflag] = lsqcurvefit(...)landedThe x that fits F(x,xdata) to ydata in least squares -- lsqnonlin on F(x,xdata) - ydata, which is all MATLAB's lsqcurvefit is
checkGradientscheckGradients(f,x0[,"Tolerance",t])landedtrue when the gradient f returns as its SECOND output agrees with a finite-difference one near x0. f is a function [f, g] = name(x) reached by a handle; an anonymous body has one output and cannot be checked
ode45[t,y] = ode45(f,tspan,y0[,opts])landedThe initial-value problem y' = f(t,y) integrated by the Dormand-Prince (4,5) pair, MATLAB's own ode45 step control and free quartic interpolant. tspan is [t0 tfinal], or the times to report at
linproglinprog(f[, A, b, Aeq, beq, lb, ub]) / [x, fval, exitflag] = linprog(...)landedmin f'x subject to A*x <= b, Aeq*x = beq and bounds. Two-phase simplex, so the answer is a vertex and exact. ⚠ Variables are FREE unless lb says otherwise. exitflag 1 solved, -2 infeasible, -3 unbounded
quadprogquadprog(H, f[, A, b, Aeq, beq, lb, ub]) / [x, fval, exitflag] = quadprog(...)landedmin 0.5*x'*H*x + f'*x over the same constraints, by an active-set method: exact where MATLAB's interior point stops on a tolerance. H is symmetrised; a non-convex H is refused
lsqlinlsqlin(C, d[, A, b, Aeq, beq, lb, ub]) / [x, resnorm, residual, exitflag] = lsqlin(...)landedmin \|\|C*x - d\|\|^2 over the same constraints. ⚠ resnorm is the SQUARED residual norm, and residual is the signed vector C*x - d. Unconstrained it is the QR least squares (C\\d); constrained it is quadprog on C'*C
intlinprogintlinprog(f, intcon, A, b[, Aeq, beq, lb, ub]) / [x, fval, exitflag] = intlinprog(...)landedmin f'x with the variables intcon names (ONE-BASED) restricted to integers. Branch and bound over linprog; A and b are required, empty if there are no inequalities

System Identification Toolbox#

Row says whether the name is here as a landed row — MATLAB's name, answered MATLAB's way — or as an extra: the console's own, carried ahead of the row that lands MATLAB's form of it, so what a pasted MATLAB call means under that name is not yet settled.

FunctionSignatureRowMeaning
tffittffit(u,y,numOrder,denOrder,Ts[,"method"])extraFit a discrete transfer function of given NUMERATOR and DENOMINATOR order to input/output data by one of ICore's own ten estimators; the optional method names one (see tffitMethods). This was spelled tfest until T6.2: MATLAB's tfest(data, np, nz) reads POLES and ZEROS in the same two slots, so the two five-argument calls could not be told apart and this one moved
armaxarmax(u,y,Ts,[na nb nc nk])landedMATLAB's armax: the prediction-error ARMAX fit, answered as the discrete transfer function B over A. [G, C] = armax(...) also answers the noise polynomial C, which a transfer function has nowhere to keep. The search is MATLAB's own -- an arx/IV initialisation, a Gauss-Newton line search over the zero-initial-state prediction error -- because where a prediction-error iteration stops IS the answer. MATLAB's default InitialCondition of 'auto' sometimes picks backcasting instead of a zero state; this console is always the zero state, and armaxOptions('InitialCondition','zero') is the MATLAB call that matches it
oeoe(u,y,Ts,[nb nf nk])landedMATLAB's oe: the output-error fit, answered as the discrete transfer function B over F. No noise model: H = 1, so there is no second output to ask for. Same search and same zero-initial-state divergence as armax
bjbj(u,y,Ts,[nb nc nd nf nk])landedMATLAB's bj: the Box-Jenkins fit, answered as the discrete transfer function B over F. [G, C, D] = bj(...) also answers the noise polynomials C and D. Same search and same zero-initial-state divergence as armax
pempem(u,y,Ts,sys)landedMATLAB's pem over an INITIAL MODEL: the prediction-error refinement of sys, read as an output-error structure (its numerator is B with the delay as leading zeros, its denominator F). MATLAB converts a transfer function handed to pem into an idtf and answers the same numbers. A bare pem(u, y, Ts) is refused here and is NOT refused by MATLAB, which answers a default state-space estimate instead
ssestssest(u,y,Ts,nx)landedMATLAB's ssest, REFUSED with the reason: it is n4sid followed by a state-space prediction-error refinement whose engine is not on this console, and its default answer is a continuous-time model. Write n4sid(u, y, Ts, nx) for the subspace estimate it starts from
ssregestssregest(u,y,Ts,nx)landedMATLAB's ssregest, REFUSED with the reason: it estimates a regularised high-order ARX model and reduces it, which is neither n4sid's algorithm nor arx's. Write n4sid(u, y, Ts, nx) or arx(u, y, Ts, [na nb nk])
arxarx(u,y,Ts,[na nb nk])landedMATLAB's arx: the least-squares ARX fit, answered as the discrete transfer function whose numerator and denominator rows ARE MATLAB's m.B and m.A. The regression starts at max(na, nb-(nk==0), 1)+1 -- a rule that does not mention nk -- and an input regressor reaching before the record contributes a zero rather than dropping its equation
arar(y,n[,approach[,window]])landedMATLAB's ar: the AR fit of a time series, answered as the row [1 a1 .. an]. The approach is "fb" (the DEFAULT, forward-backward), "ls", "yw", "burg" or "gl"; the window is "now" (default), "prw", "pow" or "ppw", and "yw" always uses "ppw" whatever is asked. [a, refl] = ar(y, n, "burg") also answers the reflection coefficients and the loss after each lattice stage
ivarivar(y,na[,nc])landedMATLAB's ivar: the instrumental-variable AR fit, answered as the row [1 a1 .. ana]. The instruments come from a whitening AR of order na+nc, a noise polynomial C reflected into the unit disc if it came out unstable, and the series filtered by 1/(C*C)
rpemrpem(z,[na nb nc nd nf nk],adm,adg)landedMATLAB's rpem: the recursive prediction-error trajectory over the general model A(q)y = [B/F]u + [C/D]e, so [na nb 0 0 0 nk] is ARX, [na nb nc 0 0 nk] ARMAX, [0 nb 0 0 nf nk] output error and the whole vector Box-Jenkins. Its gain is formed from the GRADIENT rather than from the regressor, which is what separates it from rarx once the model has a C, D or F polynomial
covfcovf(z,M)landedMATLAB's covf: the BIASED covariance function of the columns of z, to M lags. Row i+(j-1)*nz, column k+1 holds the mean of z_i(t)*z_j(t+k) over the WHOLE record, so R decays as the lag runs out of data. The output goes in the first column, as it does for rarx and not as it does for etfe/spa
etfeetfe(u,y,Ts[,M[,N]])landedMATLAB's etfe: the empirical transfer function estimate, the ratio of the output's Fourier transform to the input's, at N frequencies (default 128) evenly spaced over (0, pi/Ts]. M smooths with a Hamming lag window and MATLAB HALVES it first, so etfe(u,y,Ts,8) smooths over four lags. [g, w] = etfe(...) also answers the frequency grid
spaspa(u,y,Ts[,M[,w]])landedMATLAB's spa: the Blackman-Tukey spectral estimate, covariances to M lags through a Hann lag window. M defaults to min(30, floor(N/5)) -- MEASURED on R2026a, and not the floor(N/10) its source appears to state. [g, w, phi] = spa(...) also answers the frequency grid and the noise spectrum (the idfrd's SpectrumData)
rarxrarx(z,[na nb nk],adm,adg)landedMATLAB's rarx: the ARX parameter TRAJECTORY over the record -- row k is what an online estimator would hold after reading row k of z = [y u]. adm is "ff", "kf", "ng" or "ug" and adg its forgetting factor, drift covariance or gain. [thm, yhat, P] = rarx(...) also answers the one-step predictions and the final covariance
arxstrucarxstruc(ue,ye,uv,yv,Ts,NN)landedMATLAB's arxstruc: one ARX fit per [na nb nk] row of NN on the estimation pair, scored on the validation pair. Answers MATLAB's 4-row matrix -- the losses over the orders -- whose LAST column is a footer holding the validation sample count and the mean square of the validation output. It drops one more sample than arx does, so its loss is not the residual of the model arx returns
selstrucselstruc(V,c)landedMATLAB's selstruc: the [na nb nk] row of V with the smallest penalised loss, V*(1 + c*(na+nb)/N). c is 0 for the plain minimum, or "aic" (c = 2) or "mdl" (c = log N) -- the original Akaike form, not the log of anything. [nn, Vmod] = selstruc(...) also answers V without its footer and with the losses replaced by their logarithms. MATLAB's one-argument selstruc(V) opens a picker window and has no console form
delayestdelayest(u,y,Ts[,na,nb,nkmin,nkmax])landedMATLAB's delayest: the input delay whose ARX fit has the smallest loss, over nk from nkmin to nkmax with na and nb fixed. MATLAB's defaults are na = nb = 2 and nk from 0 to 40, and it scores with the SAME record as both the estimation and the validation set
goodnessOfFitgoodnessOfFit(x,xref,measure)landedMATLAB's goodnessOfFit. "NRMSE" is the RATIO norm(xref-x)/norm(xref-mean(xref)), so 0 is a perfect fit and it grows without bound as the fit worsens -- it is NOT compare's percentage, which is 100*(1-this). "NMSE" is that ratio squared; "MSE" is one number for the whole matrix, trace(e'e)/Ns. MATLAB's own help says these run from -Inf to 1, and its code says otherwise
comparecompare(u,y,Ts,sys)landedMATLAB's compare: the simulated response of sys to u, from the initial state that best explains y. The state is ESTIMATED, not zero -- the least-squares minimiser over the free-response basis C*A^t, which is findstates' rule -- and a simulation from zero is a different fit. [yh, fit, x0] = compare(...) also answers the fit percentage 100*(1-NRMSE) and that initial state. MATLAB's prediction horizon is not taken: it means something only for a model carrying a noise component, which no console model does
tffitPercenttffitPercent(u,y,numOrder,denOrder,Ts[,"method"])extraNRMSE fit percentage of that same estimate (100 = exact). Spelled tfestfit until T6.2, and it moved with tffit
simtfsimtf(tf,u)extraSimulate discrete transfer function tf's response to input u
polydatapolydata(sys)landedMATLAB's polydata, read the way idtf(G) reads a model: [A, B, C, D, F] = polydata(sys) answers the numerator as B and the denominator as F, with A, C and D all 1. ⚠ MATLAB's own arx answers an idpoly whose DENOMINATOR IS A and whose F is 1, so polydata of a model this console's arx built names the same numbers in different slots -- a transfer function does not remember which estimator made it. ⚠ A discrete idtf is in z^-1, so a numerator shorter than its denominator is LEFT-padded here and the pair is normalised by the leading denominator coefficient
idssdataidssdata(sys)landedMATLAB's idssdata: [A, B, C, D, K, x0] = idssdata(sys). K is the Kalman gain of the noise channel and x0 the estimated initial state, and BOTH ARE ZERO for every console model -- as they are for MATLAB's own idss(ss(G)), because a model that was converted rather than estimated has no noise channel and no record to have started from
getpvecgetpvec(sys[,"free"])landedMATLAB's getpvec: the model's free parameters as a column. For a transfer function that is idtf's order -- the WHOLE numerator (its leading zeros are parameters here, not a delay), the denominator after its monic leading 1, then the input delay; for a state-space model it is A, B, C, D and K, each column-major. ⚠ MATLAB's estimators answer an idpoly, whose vector drops B's leading zeros as the delay nk, so getpvec of MATLAB's own arx model is SHORTER than this one
setpvecsetpvec(sys,p)landedMATLAB's setpvec: the model rebuilt with p in place of its parameters, in getpvec's order and of getpvec's exact length. The last entry is MATLAB's input delay and must be 0 here -- a delay lives on the model (sys.InputDelay), not in the parameter vector
getcovgetcov(sys)landedMATLAB's getcov: the parameter covariance, which is ALWAYS EMPTY here. MATLAB answers [] for a model that was built rather than estimated and a real covariance for one an estimator produced; no console model carries an estimation report, so [] is the only true answer and the divergence is named rather than filled with zeros
idtfidtf(num,den[,Ts])landedMATLAB's idtf constructor: an identified transfer function is a tf here (T0.9). ⚠ A DISCRETE idtf's rows are in z^-1 and this console's tf is in z, so the shorter row is RIGHT-padded -- idtf([1 2], [1 -0.8 0.15], 0.1) is (z^2+2z)/(z^2-0.8z+0.15), which is NOT tf([1 2], [1 -0.8 0.15], 0.1). A continuous idtf's rows are descending s and pass straight through
idpolyidpoly(A,B[,C,D,F],"Ts",Ts)landedMATLAB's idpoly constructor, answered as the dynamic model B/(A*F). ⚠ C and D are the NOISE model and a console model has nowhere to keep them, so a non-trivial C or D is refused rather than dropped -- read a fitted noise polynomial off the estimator instead, [G, C] = armax(...) and [G, C, D] = bj(...). A polynomial model is always discrete and its sample time is not optional here, where MATLAB would leave it unspecified
idssidss(A,B,C,D,K,x0,Ts)landedMATLAB's idss constructor: an identified state-space model is an ss here (T0.9). K (the Kalman gain) and x0 (the initial state) have no home on a console ss and must be zero -- the initial state is an argument to the simulation instead, initial(sys, x0) and lsim(sys, u, t, x0). MATLAB's shorter forms leave Ts unspecified (-1), a state this console's models do not have
simsim(sys,u)landedThe model's forced response from a ZERO state, MATLAB's sim on an identified model -- exactly filter(B, A, u). sim on a SIMULINK model name is off this board (Z6) and is refused by that name. The console's simtf computes the same thing and stays as an extra
predictpredict(sys,u,y,Ts,k)landedThe k-step-ahead prediction of y, MATLAB's predict with 'InitialCondition','z'. k is a whole number of steps or Inf, which is the pure simulation. ⚠ MATLAB's DEFAULT initial condition is 'auto', which estimates a state and makes its first na samples equal the measured output; this answers the zero-state form, and the two agree to 5e-15 everywhere else
forecastforecast(sys,u,y,Ts,K[,uf])landedK samples BEYOND the record, continuing the model's own recursion with the noise at its mean of zero. Without uf the future input is zero, which is MATLAB's own default; with it, uf holds exactly K samples. Answers the K new samples alone, not the record with them appended
residresid(u,y,Ts,sys)landedThe one-step prediction errors e = y - yhat of a model against a record, MATLAB's first resid output. ⚠ MATLAB's second output is a 26 x 2 x 2 correlation array; an N-D result is off this board (Z10), so it is refused by name rather than flattened to a shape MATLAB has no spelling for

Aerospace Toolbox#

Row says whether the name is here as a landed row — MATLAB's name, answered MATLAB's way — or as an extra: the console's own, carried ahead of the row that lands MATLAB's form of it, so what a pasted MATLAB call means under that name is not yet settled.

FunctionSignatureRowMeaning
quatfromaxisanglequatfromaxisangle(axis,angle)landedQuaternion from a rotation axis and angle (radians)
quatfromeulerquatfromeuler(yaw,pitch,roll)landedQuaternion from ZYX Euler angles (radians)
quat2eulerquat2euler(q)landedQuaternion to ZYX Euler angles (radians)
quatmulquatmul(q1,q2)extraHamilton product q1*q2 (compose rotations)
quatconjquatconj(q)landedQuaternion conjugate [w -x -y -z]. TWO shapes: MATLAB's Aerospace N x 4 of rows, answering an N x 4, and the console's own 4 x 1 column, answering a column (T0.7). MATLAB rejects a 4 x 1 outright, so no Aerospace code changes meaning here
quatinvquatinv(q)landedQuaternion inverse: the conjugate over quatnorm, the SQUARED modulus. Same two shapes as quatconj. A zero quaternion answers NaN, as MATLAB's does -- it is a division, not a guarded case
quatnormalizequatnormalize(q)landedUnit-normalize a quaternion: q over quatmod, the modulus itself (NOT quatnorm). Same two shapes as quatconj
quatslerpquatslerp(q1,q2,t)extraSpherical linear interpolation, t in [0,1]
rotatevectorrotatevector(q,v)extraRotate 3x1 vector v by quaternion q
quatmultiplyquatmultiply(q[,r])landedHamilton product q*r over N x 4 rows [w x y z], one result per row; a 1 x 4 broadcasts against an N x 4 either way round. With ONE argument it is q*q -- quatmultiply([1 2 3 4]) is [-28 4 6 8], which is MATLAB's answer too. The order is not symmetric: q*r turns by r first
quatdividequatdivide(q,r)landedq * inv(r) over N x 4 rows, broadcasting like quatmultiply
quatnormquatnorm(q)landedThe SQUARED modulus w^2+x^2+y^2+z^2, as an N x 1 -- the trap of this family: quatnorm([1 2 3 4]) is 30, not sqrt(30). quatmod is the root, and quatinv divides by THIS one
quatmodquatmod(q)landedThe modulus sqrt(w^2+x^2+y^2+z^2), as an N x 1. quatnormalize divides by this one
quatrotatequatrotate(q,v)landedRotate the FRAME by q: q* v q, over an N x 4 of quaternions and an N x 3 of vectors, either broadcasting against the other. ⚠ It is the INVERSE of the console's rotatevector(q,v), which rotates the VECTOR -- both are "rotate v by q" in prose, and quatrotate(q,v) equals rotatevector(quatconj(q),v)
convvelconvvel(x,"from","to")landedConvert a velocity. Units: "ft/s", "m/s", "km/s", "in/s", "km/h", "mph", "kts", "ft/min".
convlengthconvlength(x,"from","to")landedConvert a length. Units: "ft", "m", "km", "in", "mi", "naut mi" (with the space).
convangconvang(x,"from","to")landedConvert a angle. Units: "deg", "rad", "rev".
convangvelconvangvel(x,"from","to")landedConvert a angular velocity. Units: "deg/s", "rad/s", "rpm".
convangaccconvangacc(x,"from","to")landedConvert a angular acceleration. Units: "deg/s^2", "rad/s^2", "rpm/s".
convmassconvmass(x,"from","to")landedConvert a mass. Units: "lbm", "kg", "slug".
convforceconvforce(x,"from","to")landedConvert a force. Units: "lbf", "N".
convpresconvpres(x,"from","to")landedConvert a pressure. Units: "psi", "Pa", "psf", "atm".
convtempconvtemp(x,"from","to")landedConvert a temperature. Units: "K", "F", "C", "R". convtemp is the only AFFINE one: it carries an offset as well as a factor.
convdensityconvdensity(x,"from","to")landedConvert a density. Units: "lbm/ft^3", "kg/m^3", "slug/ft^3", "lbm/in^3".
convaccconvacc(x,"from","to")landedConvert a acceleration. Units: "ft/s^2", "m/s^2", "km/s^2", "in/s^2", "km/h-s", "mph/s", "G's".
dcmbody2winddcmbody2wind(alpha,beta)landedBody-to-wind direction cosine matrix for one angle of attack and one sideslip angle, both in RADIANS. The 3 x 3 takes a vector written in body axes into wind axes; its transpose is the other direction. One pair at a time: MATLAB's 3-by-3-by-N batch is an N-D array this console does not have
dcmbody2stabilitydcmbody2stability(alpha)landedBody-to-stability direction cosine matrix for one angle of attack in RADIANS -- dcmbody2wind(alpha, 0), which is what MATLAB's own one-line implementation is
dcmecef2neddcmecef2ned(lat,lon)landedECEF-to-north-east-down direction cosine matrix at one geodetic latitude and longitude in DEGREES (not radians -- Aerospace's geodetic functions take degrees where its aerodynamic ones take radians)
dcm2alphabetadcm2alphabeta(dcm[,action[,tol]])landedThe angle of attack and the sideslip angle, in RADIANS, of a body-to-wind 3 x 3: [alpha,beta] = dcm2alphabeta(dcm). The action is "none" (the default, which checks nothing) or "error" (which refuses a matrix that is not orthogonal and proper to tol, default eps(2)); MATLAB's "warning" has no console channel and is refused
dcm2latlondcm2latlon(dcm[,action[,tol]])landedThe geodetic latitude and longitude, in DEGREES, of an ECEF-to-NED 3 x 3: [lat,lon] = dcm2latlon(dcm). The longitude comes from an atan2 and keeps its quadrant; the action argument is dcm2alphabeta's
quat2dcmquat2dcm(q)landedThe direction cosine matrix of one quaternion [w x y z]: the 3 x 3 that takes a vector written in the PARENT frame into the child. It is the TRANSPOSE of the rotation matrix quat2rotm answers -- the two names differ by that transpose and by their toolbox (quat2rotm is a Robotics System Toolbox spelling). A non-unit quaternion is normalised first, as MATLAB's is
dcm2quatdcm2quat(dcm[,action[,tol]])landedThe quaternion [w x y z] of a 3 x 3 direction cosine matrix, as a 1 x 4 row. The branch is chosen by the trace and then by the largest diagonal entry, which is what makes the sign deterministic: a matrix built from -q reads back as +q. The action is "none" (the default) or "error", which refuses a matrix that is not orthogonal and proper to tol (default eps(2))
angle2quatangle2quat(r1,r2,r3[,order])landedThe quaternion of three Euler angles in RADIANS. The order is one of ZYX (the default) ZYZ ZXY ZXZ YXZ YXY YZX YZY XYZ XYX XZY XZX, and it reads outermost-LAST: "ZYX" turns about z by r1 first and about x by r3 last
quat2anglequat2angle(q[,order])landedThe three Euler angles in RADIANS of one quaternion: [r1,r2,r3] = quat2angle(q). At a singularity -- pitch at +/-90 degrees for the nine asymmetric orders, r2 at 0 or pi for the three symmetric ones -- only the SUM or difference of r1 and r3 is determined, and the answer puts all of it in r1 and leaves r3 at zero
angle2dcmangle2dcm(r1,r2,r3[,order])landedThe direction cosine matrix of three Euler angles in RADIANS: R_third(r3) * R_second(r2) * R_first(r1), each a frame rotation. One triple per call -- MATLAB's 3-by-3-by-N batch is an N-D array this console does not have
dcm2angledcm2angle(dcm[,order[,limit]])landedThe three Euler angles in RADIANS of a 3 x 3: [r1,r2,r3] = dcm2angle(dcm). Two candidate triples are computed -- the ordinary extraction and one with r3 = 0 -- and the one that rebuilds the matrix more closely wins, which is dcm2angle.m's own rule. The limit words "default", "zeror3" and "robust" all reach that rule. MATLAB's fourth and fifth arguments (the validateDCM action and its tolerance) are not here; dcm2quat and dcm2rod take them and read the same matrix
rod2quatrod2quat(rod)landedThe quaternion of one Rodrigues (Gibbs) vector, as a 1 x 4 row. A zero vector answers [0 0 0 0] rather than the identity quaternion -- that is what rod2quat.m answers, and it is reproduced rather than corrected
quat2rodquat2rod(q)landedThe Rodrigues vector of one quaternion: the vector part over the scalar part, as a 1 x 3 row. MATLAB divides by cos(acos(w)) rather than by w, and the round trip is not the identity -- at w = 0 the answer is 1.633e16 where the algebra says infinity. That number is reproduced
rod2dcmrod2dcm(rod)landedThe direction cosine matrix of one Rodrigues vector. A zero vector is the identity rotation and answers the identity matrix
dcm2roddcm2rod(dcm[,action[,tol]])landedThe Rodrigues vector of a 3 x 3, as a 1 x 3 row: tan(theta/2) times the rotation axis, read off the trace and the three antisymmetric differences. The action argument is dcm2alphabeta's
rod2anglerod2angle(rod[,order])landedThe three Euler angles in RADIANS of one Rodrigues vector: [r1,r2,r3] = rod2angle(rod). It IS dcm2angle(rod2dcm(rod), order, "robust"), which is what rod2angle.m is
angle2rodangle2rod(r1,r2,r3[,order])landedThe Rodrigues vector of three Euler angles in RADIANS. Not dcm2rod(angle2dcm(...)): MATLAB's own two routes disagree by up to 8.4e-7 near a half-turn, and this one is angle2rod.m's closed forms, which are the parity
quatlogquatlog(q)landedThe logarithm of a UNIT quaternion: [0, theta * vhat], with theta the half angle acos(w). The identity quaternion answers all zeros, and so does its negative. A non-unit input is normalised first (MATLAB warns and normalises; this console has no warning channel)
quatexpquatexp(q)landedThe exponential of ANY quaternion: exp(w) * [cos\|v\|, vhat sin\|v\|]. This one does NOT normalise its input -- the scalar part is the exponential's scale, so quatexp([1 0.3 0.4 0.5]) answers a quaternion of modulus e
quatpowerquatpower(q,t)landedThe unit quaternion q raised to a real power: exp(t * log(q)), a rotation about the same axis through t times the angle. quatpower(q,-1) is the conjugate through that route rather than by negating three signs, so it answers the conjugate's numbers to a rounding rather than exactly
quatinterpquatinterp(p,q,f[,method])landedInterpolate between two quaternions at fraction f in [0,1]. The method is "slerp" (the default, constant angular rate), "lerp" (the straight line, NOT normalised) or "nlerp" (that line normalised). All three take the SHORTEST path: q is negated when the two point into opposite hemispheres, so interpolating toward -q answers the same as toward q
atmosisaatmosisa(h[,action])landedInternational Standard Atmosphere: [T, a, P, rho, nu, mu] at a geopotential altitude in metres. HELD at the limits outside [-5000, 84852] m rather than extrapolated, and h = 0 answers the sea-level base values exactly. The action word chooses a warning MATLAB prints and does not change a number
atmoscoesaatmoscoesa(h[,action])landed1976 COESA atmosphere: [T, a, P, rho]. EXTRAPOLATES outside [0, 84852] m where atmosisa clamps, and uses the gas constant R_HAT/MOL_WT where atmosisa uses P0/(rho0*T0) -- so the two disagree in the sixth digit on purpose
atmospaltatmospalt(P[,action])landedPressure altitude: the COESA altitude whose ambient pressure is P pascals. The inverse of atmoscoesa's pressure, not of atmosisa's
atmoslapseatmoslapse(h,g,gamma,R,L,hts,htp,rho0,P0,T0[,H0])landedThe parametric lapse-rate atmosphere: [T, a, P, rho, nu, mu] with every constant a caller's. Clamped to [H0, htp]; above hts the temperature stops falling and the pressure keeps falling isothermally
geoc2geodgeoc2geod(gc,r[,f,Re])landedGeocentric latitude and radius to [geodetic latitude, height]. Degrees in, degrees and metres out. A latitude past the pole folds back before anything else happens
geod2geocgeod2geoc(gd,h[,f,Re])landedGeodetic latitude and height to [geocentric latitude, radius]
lla2eceflla2ecef(lla[,f,Re])landedN x 3 [lat lon alt] in degrees and metres to N x 3 ECEF [x y z] in metres. The trigonometry is in DEGREES, so a point on the equator has an exactly zero z
ecef2llaecef2lla(p[,f,Re])landedN x 3 ECEF [x y z] to N x 3 [lat lon alt]. The inverse is an iteration (at most five steps), not a closed form -- a single Bowring pass is short by about a nanometre
lla2flatlla2flat(lla,ll0,psi0,href[,f,Re])landedN x 3 [lat lon alt] to flat-Earth [north east DOWN] metres about the reference [lat lon] ll0, rotated by the heading psi0 in degrees. The third coordinate is -alt - href: a point above the reference has a NEGATIVE z
flat2llaflat2lla(p,ll0,psi0,href[,f,Re])landedThe inverse of lla2flat
geocradiusgeocradius(lambda[,model])landedThe ellipsoid's radius in metres at a GEOCENTRIC latitude in degrees. This one converts to radians first (it goes through convang), so unlike the rest of the row it is a plain sin
gravitywgs84gravitywgs84(h,lat[,lon,method[,options]])landedWGS84 normal gravity MAGNITUDE in m/s^2. Methods: "TaylorSeries" (default, closed form, no longitude), "CloseApprox" and "Exact" (both need a longitude). Only "Exact" has the two-output form [gDown, gNorth], and it does NOT begin with the magnitude. options is [noatmos centrifugal precessing JD], whose second entry SUPPRESSES the centrifugal term
gravitycentrifugalgravitycentrifugal(p[,model])landed[gx, gy, gz] of the centrifugal acceleration alone, from an N x 3 planet-fixed position. gz is exactly zero for every input: the term is normal to the spin axis. Models: the nine planets and moon of MATLAB's own table
gravityzonalgravityzonal(p[,model][,degree])landed[gx, gy, gz] of the zonal-harmonic attraction (J2 to J4) from an N x 3 position, with NO centrifugal term. A degree above the model's own J list drops to it. Earth is JGM-2
airspeedairspeed(vel)landedThe norm of each ROW of an N x 3 body-axis velocity. A three-element row is ONE velocity, not three speeds
machnumbermachnumber(vel,a)landedairspeed(vel) over the local speed of sound; a is a scalar or one entry per row
dpressuredpressure(vel,rho)landedDynamic pressure, 0.5*rho*\|vel\|^2, over the norm of each row
alphabetaalphabeta(vel)landed[alpha, beta] -- angle of attack atan2(w, u) and sideslip asin(v/\|vel\|), both in RADIANS. A zero velocity answers a zero sideslip, not a NaN
correctairspeedcorrectairspeed(v,a,P0,from,to[,"Equation"])landedConvert between "TAS", "CAS" and "EAS". TAS<->EAS is the density ratio and needs nothing else; every conversion touching CAS needs "Equation" as the sixth argument, because MATLAB's default "TableLookup" splines a shipped data file this console does not carry
juliandatejuliandate(y,mo,d[,h,mi,s])landedThe Julian date of a calendar instant, also spelled juliandate([y mo d]) or juliandate([y mo d h mi s]) with one ROW per date. A fractional month is scaled by the length of THAT month; every other field is linear
mjuliandatemjuliandate(y,mo,d[,h,mi,s])landedThe modified Julian date -- juliandate less 2400000.5, which puts the day boundary at midnight instead of noon
decyeardecyear(y,mo,d[,h,mi,s])landedThe year plus the fraction of it elapsed. The divisor is the length of THAT year, so 1 July is .4959 of a common year and .4973 of a leap one
leapyearleapyear(y)landedA LOGICAL array: divisible by 4 and not by 100, or divisible by 400. The year is floored first, so 2004.9 is a leap year
siderealTimesiderealTime(utcJD[,dUT1,dAT])landedGreenwich MEAN sidereal time in DEGREES at a Julian date. dUT1 shifts the date by its seconds; dAT is validated and does not enter the mean value. The APPARENT sidereal time is not here -- MATLAB's own help says it needs the Ephemeris Data add-on

Curve Fitting Toolbox#

Row says whether the name is here as a landed row — MATLAB's name, answered MATLAB's way — or as an extra: the console's own, carried ahead of the row that lands MATLAB's form of it, so what a pasted MATLAB call means under that name is not yet settled.

FunctionSignatureRowMeaning
fittypefittype(expr[,"independent",x][,"coefficients",a,b,...])landedft = the model itself, unfitted (T8.6). fittype("a*exp(-b*x)") reads the expression with this console's own grammar and takes every free name that is not the independent variable as a coefficient, in ALPHABETICAL order -- so fittype("c*x^2 + a*x + b") has coefficients a, b, c, which is the trap for a "StartPoint" vector. fittype("poly2") names a library model. ⚠ MATLAB's LINEAR-TERMS form fittype({"x", "1"}) is spelled fittype("terms", "x", "1") here, because C12 gives this console no cell kind
coeffvaluescoeffvalues(f)landedThe fitted coefficients as a ROW, in the model's coefficient order (T8.8)
coeffnamescoeffnames(f)landedThe coefficient names. ⚠ MATLAB answers a CELL and this answers ONE STRING with the names separated by single spaces -- C0.3 gives this console one string kind and C12 no cell, so the names are readable and splittable rather than refused (T8.8)
formulaformula(f)landedThe model's formula as MATLAB writes it -- "p1*x + p2" (T8.8)
numcoeffsnumcoeffs(f)landedHow many coefficients the model has (T8.8)
categorycategory(f)landed"library", "custom", "interpolant" or "spline" (T8.8)
typetype(f)landedThe model's own name -- "poly1", "exp1", "customnonlinear" (T8.8). ⚠ It answers for a FIT only: type is also base MATLAB's file-listing command, and this console has neither that nor a reason to shadow the word for anything else
indepnamesindepnames(f)landedThe independent variable's name, "x" unless the fittype said otherwise (T8.8). ⚠ A SURFACE has TWO and answers them as ONE string separated by a space -- "x y" -- where MATLAB answers a cell of two, because this console has no cell type (T8.13)
dependnamesdependnames(f)landedThe dependent variable's name, "y" unless the fittype said otherwise (T8.8)
argnamesargnames(f)landedEvery coefficient name and then the independent variable, in one string (T8.8)
confintconfint(f[,level])landedThe 2-by-ncoeff confidence bounds on the coefficients, lower row then upper, at level (0.95 by default) -- b +/- tinv(1-(1-level)/2, dfe)*sqrt(diag(inv(X'X))*sse/dfe), which is confint.m line for line (T8.9). ⚠ Refused for an interpolant and a spline, as MATLAB refuses them: there are no coefficients to bound. A coefficient pinned at a bound answers NaN, because it was not estimated
predintpredint(f,x[,level[,"observation"|"functional"[,"on"|"off"]]])landedThe n-by-2 prediction bounds at the points x (T8.9). ⚠ A SURFACE is asked at an N-by-2 MATRIX and only that -- predint(sf, [x y]) -- because the third argument is the level, which is why MATLAB answers "XY must have two columns." for predint(sf, x, y) and so does this (T8.13). "observation" (the default) predicts a NEW measurement and "functional" the fitted curve; "on" makes the band simultaneous over every x, through sqrt(p*finv(level,p,dfe)) instead of the t quantile
differentiatedifferentiate(f,x)landed[d1, d2] = the first and second derivative of the fit at x. ANALYTIC for a library model -- each carries its own derivative, as MATLAB's does -- and central differences with MATLAB's own step for a custom one and for rat* (T8.10). ⚠ ON A SURFACE THE TWO OUTPUTS MEAN SOMETHING ELSE, and it is MATLAB's naming: [fx, fy] = differentiate(sf, [x y]) are the two PARTIAL FIRST derivatives, df/dx and df/dy, not the first and second (T8.13). It takes the coordinates apart too -- differentiate(sf, x, y)
csapscsaps(x,y[,p[,xx]])landedThe cubic SMOOTHING spline (T8.4): p = 1 interpolates, p = 0 is the least-squares straight line, and with no p the one csaps.m's own rule picks -- 1/(1 + trace(R)/(6*trace(QtWQ))), which is 0.9 on a unit grid. [f, p] = csaps(x, y) hands that number back. ⚠ MATLAB answers a pp STRUCT and this console has no struct kind, so csaps(x, y[, p]) answers the FIT holding the same curve (evaluate it with f(xq)); the four-argument csaps(x, y, p, xx) answers numbers on both sides. Same curve as fit(x, y, "smoothingspline")
csapicsapi(x,y[,xx])landedThe not-a-knot cubic INTERPOLANT (T8.15), as a pp form -- csapi(x, y) answers the form and csapi(x, y, xx) the values, which is core spline(x, y, xx)'s own curve to the last digit. A pp is read with f.breaks, f.coefs, f.pieces and f.order, evaluated with fnval(f, xx), and f.form refuses by name because it is a character field.
csapecsape(x,y[,conds[,valconds]])landedThe cubic interpolant with a CHOSEN end condition (T8.15), as a pp form. conds is "complete"/"clamped", "not-a-knot", "periodic", "second" or "variational", or the pair [left right] of 0 (periodic), 1 (first derivative) and 2 (second); valconds holds the two end values, and MATLAB's grandfathered spelling -- TWO more values in y than sites -- says the same thing. ⚠ With no end values csape does NOT clamp the slope to zero: it estimates the end slope by local interpolation through the first three or four points, so csape(x, y) and csape(x, y, "complete", [0 0]) are different curves.
spap2spap2(knots,k,x,y[,w])landedThe least-squares spline of order k in B-form (T8.15). The first argument is either the knot sequence or the NUMBER of polynomial pieces, in which case aptknt picks knots that satisfy the Schoenberg-Whitney conditions for these sites. w weighs the data points. Read the answer with sp.knots, sp.coefs, sp.number and sp.order, and evaluate it with fnval.
fnvalfnval(f,x[,side])landedEvaluate a pp or a B-form at x (T8.15). The two arguments may be given in either order, as in MATLAB; the third is the left-continuity flag, which changes nothing away from a repeated interior knot.
fnderfnder(f[,n])landedDifferentiate a form n times (T8.15), answering a form of order n lower. A NEGATIVE n integrates -- fnder.m's own arm -- and differentiating past the order answers the zero function on the basic interval as one piece.
fnintfnint(f[,value])landedThe indefinite integral of a form (T8.15), as a form one order higher. The second argument is the value at the left end of the basic interval; with none it is zero.
ppmakppmak(breaks,coefs[,d])landedBuild a pp form from breaks and coefficients (T8.15). ⚠ ppmak(breaks, coefs) reads the ROWS of coefs as the target dimension and its COLUMNS as pieces*order, so ppmak([0 1 2], [1 2; 3 4]) is a two-VALUED spline of order 1 in MATLAB and is refused here; ppmak(breaks, coefs, 1) reads coefs as the pieces-by-order matrix that f.coefs prints.
spmakspmak(knots,coefs[,sizec])landedBuild a B-form from a knot sequence and its coefficients (T8.15). The order is length(knots) - length(coefs), and a B-spline that a repeated knot has made trivial is thrown out, as chckknt does.
fn2fmfn2fm(f[,form[,sconds]])landedConvert between the two forms (T8.15): "pp" and "B-". ⚠ pp -> B- DROPS the breaks the spline is smooth across, which is pp2sp.m's documented behaviour -- a not-a-knot cubic through six points comes back with four knots, because it is C3 across the second and the second-to-last. "BB" is refused: a Bernstein-Bezier record would carry the same fields as a B-form one and this console tells forms apart by their fields.
fnpltfnplt(f)landedRefused (T8.15): fnplt DRAWS a form, and this console draws through its own plot verbs -- plot(xx, fnval(f, xx)) is the same picture.
integrateintegrate(f,x,x0)landedThe integral of the fit from x0 to each entry of x. Closed form where the model has one, adaptive Simpson otherwise -- the same split MATLAB makes (T8.10). ⚠ A SURFACE has no integrate on EITHER side -- MATLAB answers "Undefined function 'integrate' for input arguments of type 'sfit'" -- and this refuses it by name (T8.13)
prepareCurveData[xd,yd] = prepareCurveData(x,y[,w])landedColumn-ises the inputs, takes the real part of a complex one and drops every point where any of them is NaN or Inf -- PAIRWISE, so the vectors stay the same length. An empty x is replaced by 1:numel(y). MATLAB requires as many outputs as inputs, so a one-output call of a two-input form is an error on both sides
prepareSurfaceData[xd,yd,zd] = prepareSurfaceData(x,y,z[,w])landedThe same preparation for a surface, with one step in front: when x and y are vectors and z is a table of values, the two are expanded by meshgrid to match it. MATLAB warns and swaps them when they match z the other way round; this console does the same silently, having no warning channel
excludedataexcludedata(x,y,method,opt)landedA 0/1 mask of the points to EXCLUDE -- true means excluded. The method is "indices", "domain" (on x), "range" (on y) or "box" ([x1 x2 y1 y2]), matched by prefix as MATLAB matches it