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#
| Command | What it does | Registered in |
|---|---|---|
agentBridge | Whether 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 |
agentCheck | Check 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.json | ICoreAgentCommands.cpp |
agentGuide | The instruction files a coding agent reads in the open project, and whether new projects get them: agentGuide [status\|write\|refresh\|on\|off] | ICoreAgentCommands.cpp |
agentServe | Serve the agent bridge from a headless --console run: agentServe [seconds] [--project <folder>] | ICoreAgentCommands.cpp |
checkUpdates | — | ICoreUpdateCommands.cpp |
clc | Clear the active output log (MATLAB's name for cls) | ICoreWorkspaceCommands.cpp |
clear | Remove variables: clear, clear x y, clear all (the output log is clc/cls) | ICoreWorkspaceCommands.cpp |
clearAll | Clear all logs, the variables space, and recipe handles | ICoreCommandSamples.cpp |
clearAllLogs | Clear all output logs | ICoreCommandSamples.cpp |
clearCommandHistory | Forget every command line recalled by the Up arrow, in this session and previous ones | ICoreCommandHistoryStore.cpp |
clearRecipeHandles | Clear all recipe handle bindings | ICoreCommandSamples.cpp |
clearVariablesSpace | Clear all variables from the variables space | ICoreCommandSamples.cpp |
clearvars | Remove variables: clearvars, clearvars x y (same as clear) | ICoreWorkspaceCommands.cpp |
cls | Clear the current output log | ICoreCommandSamples.cpp |
COMMAND_GET | Print one simulation/solver setting: getModelConfig <property> | ICoreModelConfigCommands.cpp |
COMMAND_PRINT | Print every simulation/solver setting and its current value | ICoreModelConfigCommands.cpp |
COMMAND_SET | Set one simulation/solver setting: setModelConfig <property> <value> | ICoreModelConfigCommands.cpp |
commandParityPrepare | — | ICoreCommandParityCommands.cpp |
diagramExportVerify | — | ICoreParityDiagramCommands.cpp |
diagramPrepare | — | ICoreParityDiagramCommands.cpp |
docsSample | — | ICoreDocsSampleCommands.cpp |
drawnow | Accepted and does nothing: this console draws on the thread the script runs on, so there is never a queued repaint to flush | ICoreWorkspaceCommands.cpp |
echo | Print the arguments back | ICoreCommandSamples.cpp |
exportVerify | — | ICoreParityCommands.cpp |
format | Display precision: format short (the default) or format long | ICoreWorkspaceCommands.cpp |
fromMatlab | — | ICoreMatlabCommandBridge.cpp |
generateRecipe | Print a recipe script reproducing a subsystem's block diagram (default: Home) | ICoreCommandSamples.cpp |
glossary | List all commands, matrix functions, and syntax | ICoreCommandSamples.cpp |
guiBless | — | ICoreGuiRegressionCommands.cpp |
guiList | — | ICoreGuiRegressionCommands.cpp |
guiTest | — | ICoreGuiRegressionCommands.cpp |
help | List all registered commands, or help <name> for one glossary entry | ICoreCommandEngine.cpp |
licenseStatus | — | ICoreAccountCommands.cpp |
matlabExportScript | — | ICoreMatlabCommandBridge.cpp |
matlabImportScript | — | ICoreMatlabCommandBridge.cpp |
messageTraffic | — | ICoreMessageTrafficCommands.cpp |
name | — | ICoreCommandEngine.cpp |
navigationRootAccess | Print whether the tree above Home (Root / Temp / Trash) is reachable | ICoreNavigationCommands.cpp |
openTemplate | Open 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 |
reloadProject | Re-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 |
reverse | Reverse the given text | ICoreCommandSamples.cpp |
run | Run a saved script in this workspace: run <name> | ICoreWorkspaceCommands.cpp |
saveTemplate | Save the current diagram level as a reusable subsystem template: saveTemplate <name> | ICoreTemplateCommands.cpp |
setNavigationRootAccess | Show or hide the tree above Home: setNavigationRootAccess <on\|off> | ICoreNavigationCommands.cpp |
simulate | Run 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 |
targets | List the Deploy to Hardware targets: name, language, source subsystem, folder. t = target(<language>) makes one; t.listConfig shows its settings; t.fire() exports | ICoreScriptTargets.cpp |
templates | List the ready-to-use diagram templates (optionally filtered by category or kind) | ICoreTemplateCommands.cpp |
terminalHosts | The processes that keep the Terminal panel's shells alive if the app crashes: terminalHosts [list], terminalHosts end <host pid>, terminalHosts end left-behind | ICoreAgentCommands.cpp |
tffitMethods | List 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 |
timeSeriesDemo | Declare a demo time series in the variables space (default name: demoSignal) | ICoreCommandSamples.cpp |
toMatlab | — | ICoreMatlabCommandBridge.cpp |
toolchain | — | ICoreToolchainCommands.cpp |
trim-slashes | Strip leading/trailing slashes from a path | ICoreCommandSamples.cpp |
useTemplate | Insert a subsystem template into a diagram level: useTemplate <id> [parent] [x] [y] | ICoreTemplateCommands.cpp |
version | Show the product version, commit and build date | ICoreCommandSamples.cpp |
who | List the names of the variables in the workspace | ICoreWorkspaceCommands.cpp |
whos | List the variables with their size, byte count and class | ICoreWorkspaceCommands.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.
| Keyword | Signature | Opens a block | Meaning |
|---|---|---|---|
if | if cond … elseif cond … else … end | yes | Run the first branch whose condition holds; a condition holds when it is non-empty and every element of it is non-zero |
elseif | elseif cond | — | A further condition inside an open if block |
else | else | — | The branch an if takes when none of its conditions held |
for | for name = expr … end | yes | Repeat 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 |
while | while cond … end | yes | Repeat the body for as long as the condition holds |
switch | switch expr … case value … otherwise … end | yes | Run the first case arm whose value matches expr |
case | case value | — | One arm of an open switch block |
otherwise | otherwise | — | The arm a switch takes when no case matched |
break | break | — | Leave the innermost for or while body |
continue | continue | — | Skip to the next iteration of the innermost for or while body |
return | return | — | Stop the running script; inside a script-defined function, return from it |
function | function [o1, o2] = name(a, b) … end | yes | Define a session-scoped function with its own workspace |
try | try … catch err … end | yes | Run the body and hand a failure to the catch arm instead of stopping the script |
catch | catch err | — | The arm a try takes when its body failed; err binds the error |
end | end | — | 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).
| Verb | Signature | Meaning |
|---|---|---|
addPort | p = handle.addPort(in|out, type?, facing?) | Add a port to a block (type defaults to ICoreDouble; refused if that port list is private). Types: |
applyStyle | linePathHandle.applyStyle(styleBlob) | Apply a ";"-joined ICoreChartLinePath::captureStyle blob (color, pen, visibility, ...) — round-trip, not meant for hand-authoring |
area | a? = area(parent?) | Create a canvas work area (parent defaults to Home) |
autoArrange | subsystemHandle.autoArrange() | Auto-arrange every block in a subsystem (handle must be a subsystem's block, as bound by subsystem()) |
block | handle = block(type, parent?) | Create a block (parent defaults to Home) and bind it to a handle |
chart | c = handle.chart() | Bind a handle to a block's attached chart (Scope-type blocks only) — behaves like a plot() chart handle |
clear | chartHandle.clear | Delete every line path on a chart |
clearAllSelections | selectionModelHandle.clearAllSelections | Drop everything a selection model currently holds |
clearDiagram | clearDiagram(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 |
clearImage | imageHandle.clearImage | Drop an image holder's picture, back to the placeholder |
clearPorts | handle.clearPorts() | Delete every port on the block's non-private port lists |
commentOut | handle.commentOut | Comment out a block so it is excluded from the run |
connect | l? = 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 |
defineEnum | defineEnum(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 |
delete | handle.delete | Permanently delete a block, link branch, area, image or textbox (no trash, no undo); deleting a link's root branch deletes the whole link |
deselectArea | selectionModelHandle.deselectArea(areaHandle) | Remove a canvas area from a selection model |
deselectBlock | selectionModelHandle.deselectBlock(blockHandle) | Remove a block from a selection model |
deselectImage | selectionModelHandle.deselectImage(imageHandle) | Remove an image holder from a selection model |
deselectLinkBranch | selectionModelHandle.deselectLinkBranch(branchHandle) | Remove a link branch from a selection model |
deselectTextBox | selectionModelHandle.deselectTextBox(textboxHandle) | Remove a text box from a selection model |
disableFlushingTimer | chartHandle.disableFlushingTimer | Stop the auto-flush timer (flushing whatever is buffered once more first) |
disconnect | portHandle.disconnect | Detach the port from its link branch; the link stays, with that end left dangling |
duplicate | selectionModelHandle.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 |
enableFlushingTimer | chartHandle.enableFlushingTimer | Start auto-flushing buffered points (from pushPoint) onto the chart every 100ms |
exportAsEPS | chartHandle.exportAsEPS(path) | Export a chart to an Encapsulated PostScript file |
exportAsImage | chartHandle.exportAsImage(path) | Export a chart to a png/jpg image (format from the extension) |
exportAsPDF | chartHandle.exportAsPDF(path) | Export a chart to a PDF file |
exportAsSVG | chartHandle.exportAsSVG(path) | Export a chart to an SVG file |
exportDataCSV | chartHandle.exportDataCSV(path) | Export a chart's plotted data to a CSV file |
fire | targetHandle.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 |
get | v? = handle.get(property) | Print one block property (name, path, x, y, width, ...); v = ... stores a numeric snapshot in the variables space |
getBlock | handle = 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) |
getBufferWidth | chartHandle.getBufferWidth | Print a chart's streaming buffer width |
getConfig | v? = handle.getConfig(variableName) | Print one non-private block config variable; v = ... stores a numeric snapshot in the variables space |
getCorners | branchHandle.getCorners | Print a link branch's path corners in the same '(x, y), ...' form setCorners accepts |
getTarget | t = getTarget(name) | Bind a handle to a Deploy to Hardware target that already exists, by name (targets lists them) |
getText | textboxHandle.getText | Print a text box's text |
getTitle | areaHandle.getTitle | Print a canvas area's title bar text |
hideName | handle.hideName | Hide the name label drawn under a block |
holdOn | chartHandle.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) |
image | i? = image(parent?) | Create an image holder (parent defaults to Home) |
info | handle.info | Print the block's full property sheet |
inputPort | p = handle.inputPort(i) | Bind a handle to a block's existing input port [i], or chain a port method: handle.inputPort(i).disconnect() |
isInfiniteStreaming | chartHandle.isInfiniteStreaming | Print whether infinite streaming is on for a chart |
listConfig | handle.listConfig | Print the block's non-private config variables |
loadImage | imageHandle.loadImage(path) | Load a picture from disk into an image holder (quotes optional) |
loglog | c? = loglog(...) | plot() with both axes base-10 logarithmic; same arguments |
migrate | selectionModelHandle.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 |
move | handle.move(x, y) | Move a block, area, image or textbox relative to the origin anchor (+y is up) |
optimizeLinks | subsystemHandle.optimizeLinks() | Re-run the link path optimizer over every block in a subsystem (handle must be a subsystem's block, as bound by subsystem()) |
outputPort | p = handle.outputPort(i) | Bind a handle to a block's existing output port [i], or chain a port method: handle.outputPort(i).disconnect() |
path | p? = chartHandle.path(i) | Bind a handle to one of a chart's existing line paths |
plot | c? = 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 |
pushPoint | linePathHandle.pushPoint(x, y) | Buffer one point onto a line path (pair with the chart's enableFlushingTimer to see it appear) |
removePort | handle.removePort(portHandleOrName) | Delete one port from a block (refused if that port list is private) |
rename | handle.rename(newName) | Rename a block (name must be unique, no special characters) |
resize | handle.resize(width, height) | Set the width and height of a block, area, image or textbox |
rotate | handle.rotate(angle) | Set a block's rotation in degrees |
selectArea | selectionModelHandle.selectArea(areaHandle) | Add a canvas area to a selection model (refused if not a sibling of the model's current selection) |
selectBlock | selectionModelHandle.selectBlock(blockHandle) | Add a block to a selection model (refused if not a sibling of the model's current selection) |
selectImage | selectionModelHandle.selectImage(imageHandle) | Add an image holder to a selection model (refused if not a sibling of the model's current selection) |
selectionModel | s = selectionModel() | Create a standalone canvas selection model (not tied to any canvas/tab, does not touch the diagram); the handle must be bound |
selectLinkBranch | selectionModelHandle.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 |
selectTextBox | selectionModelHandle.selectTextBox(textboxHandle) | Add a text box to a selection model (refused if not a sibling of the model's current selection) |
semilogx | c? = semilogx(...) | plot() with a base-10 logarithmic x axis; same arguments |
semilogy | c? = semilogy(...) | plot() with a base-10 logarithmic y axis; same arguments |
setAxisFont | chartHandle.setAxisFont(x|y, fontBlob) | Set an axis label's font from a ";"-joined ICoreStudioStaticCommands::serializeFont blob (round-trip, not meant for hand-authoring) |
setColor | areaHandle.setColor(r, g, b[, a] | nameOrHex) | Set a canvas area's color (0-255 channels, or a named/#rrggbb color) |
setConfig | handle.setConfig(variableName, value) | Set a non-private block config variable |
setCorners | branchHandle.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) |
setDescription | portHandle.setDescription(text) | Set a port's description label (empty text clears it) |
setInfiniteStreaming | chartHandle.setInfiniteStreaming(true|false) | Toggle whether a chart keeps only the last getBufferWidth() points per line |
setMovingWindowWidth | chartHandle.setMovingWindowWidth(n) | Set how many points a streaming chart keeps per line |
setPathName | linePathHandle.setPathName(text) | Rename a chart line path |
setText | textboxHandle.setText(text) | Set a text box's text (quotes optional; empty clears) |
setTitle | areaHandle.setTitle(text) | Set a canvas area's title bar text (quotes optional) |
showName | handle.showName | Show the name label under a block again |
subsystem | handle = subsystem(parent?) | Create a subsystem (parent defaults to Home); the handle binds to its block |
target | t = 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 |
textbox | t? = textbox(parent?) | Create a canvas text box (parent defaults to Home) |
uncomment | handle.uncomment | Re-include a commented-out block in the run |
xlabel | chartHandle.xlabel(text) | Set a chart's X-axis label |
ylabel | chartHandle.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#
| Function | Signature | Meaning |
|---|---|---|
transpose | transpose(A) | Transpose of A (same as A.') |
ctranspose | ctranspose(A) | Conjugate transpose of A (same as A'); identical to transpose on real data |
plus | plus(A,B) | A + B |
minus | minus(A,B) | A - B |
uminus | uminus(A) | -A |
uplus | uplus(A) | +A |
mtimes | mtimes(A,B) | A * B (matrix product) |
times | times(A,B) | A .* B (element-wise product) |
mrdivide | mrdivide(A,B) | A / B (right division; A*inv(B) for square B) |
rdivide | rdivide(A,B) | A ./ B (element-wise division) |
mldivide | mldivide(A,B) | A \\ b (solves A*x = b; least squares when A is tall) |
ldivide | ldivide(A,B) | A .\\ B (element-wise, same as B ./ A) |
power | power(A,B) | A .^ B (element-wise power) |
inv | inv(A) | Inverse of a square matrix A |
pinv | pinv(A[,tol]) | Moore-Penrose pseudo-inverse of A; singular values at or below tol are treated as zero (default max(size(A)) * eps(largest)) |
det | det(A) | Determinant of a square matrix A |
trace | trace(A) | Sum of the diagonal of a square matrix A |
cond | cond(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 |
rcond | rcond(A) | Reciprocal condition estimate in the 1-norm, 1/(norm(A,1)*norm(inv(A),1)); 0 for a singular A |
sqrtm | sqrtm(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 |
chol | chol(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 |
null | null(A[,"r"]) | Orthonormal basis for the null space of A, as columns; "r" gives MATLAB's rational basis |
svd | svd(A[,"econ"]) / [U,S,V] = svd(A) | Singular values as a column, or the three factors A = U*S*V' |
qr | qr(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 |
lu | lu(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 |
ldl | ldl(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' |
eig | eig(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 |
eigvec | eigvec(A) | Eigenvectors of a square matrix A (real part) |
expm | expm(A) | Matrix exponential (square A) |
logm | logm(A) | Matrix logarithm (square A) |
exist | exist("name"[,"var"|"builtin"]) | 1 if name is a variable, 5 if it is a console function, 0 otherwise |
isvarname | isvarname("name") | 1 when name is a legal variable name (letter first, letters/digits/_ after, not a keyword) |
hess | hess(A) / [P,H] = hess(A) | Upper Hessenberg form H, A = P*H*P' with P orthogonal (square A) |
schur | schur(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 |
balance | balance(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 |
rank | rank(A[,tol]) | Number of singular values above tol; the default tol is MATLAB's max(size(A))*eps(norm(A,2)) |
solve | solve(A,b) | Solve A*x = b (extra: the same operation as A \\ b) |
diag | diag(A[,k]) | Vector -> diagonal matrix; matrix -> its diagonal as a vector; k picks the k-th diagonal |
kron | kron(A,B) | Kronecker product of A and B |
dot | dot(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 |
horzcat | horzcat(A,B[,C]) | Join side by side -- the function form of [A, B] |
vertcat | vertcat(A,B[,C]) | Stack -- the function form of [A; B] |
cat | cat(dim,A,B[,C]) | Join along dim: 1 stacks, 2 joins side by side |
cross | cross(a,b) | Cross product of two 3x1 vectors |
pow | pow(A,B) | Element-wise power A.^B (extra: the same operation as power) |
qrq | qrq(A) | QR decomposition: orthogonal factor Q |
qrr | qrr(A) | QR decomposition: upper-triangular factor R |
lul | lul(A) | LU decomposition: lower factor L (square A) |
luu | luu(A) | LU decomposition: upper factor U (square A) |
lup | lup(A) | LU decomposition: permutation matrix P, P*A = L*U |
svdu | svdu(A) | SVD: left singular vectors U |
svdv | svdv(A) | SVD: right singular vectors V |
ldltl | ldltl(A) | LDLT decomposition: unit lower factor L (symmetric A) |
ldltd | ldltd(A) | LDLT decomposition: diagonal D as a column vector |
ldltp | ldltp(A) | LDLT decomposition: permutation matrix P, P^T*L*diag(D)*L^T*P = A |
issymmetric | issymmetric(A) | 1 if A is symmetric, else 0 |
ispd | ispd(A) | 1 if A is symmetric positive-definite, else 0 |
pi | pi | 3.141592653589793; a variable named pi shadows it |
Inf | Inf / Inf(n) / Inf(m,n) | Positive infinity, or an m x n matrix of it (also spelled inf) |
NaN | NaN / NaN(n) / NaN(m,n) | Not-a-Number, or an m x n matrix of it (also spelled nan) |
eps | eps / eps(x) | 2.220446049250313e-16, or the distance from x to the next double |
realmax | realmax | Largest finite double, 1.7976931348623157e308 |
realmin | realmin | Smallest normalized positive double, 2.2250738585072014e-308 |
flintmax | flintmax | Largest consecutive integer a double represents exactly, 2^53 |
true | true / true(n) / true(m,n) | Logical 1, or an m x n logical array of it |
false | false / false(n) / false(m,n) | Logical 0, or an m x n logical array of it |
abs | abs(A) | Element-wise absolute value |
exp | exp(A) | Element-wise exponential |
log | log(A) | Element-wise natural logarithm |
sqrt | sqrt(A) | Element-wise square root; a negative entry answers a complex number, as MATLAB's does (sqrt(-1) is 1i) |
log2 | log2(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 |
log10 | log10(A) | Element-wise base-10 logarithm |
sin | sin(A) | Element-wise sine (radians) |
cos | cos(A) | Element-wise cosine (radians) |
tan | tan(A) | Element-wise tangent (radians) |
emin | emin(A,B) | Element-wise minimum (B may be a scalar) |
emax | emax(A,B) | Element-wise maximum (B may be a scalar) |
clamp | clamp(A,lo,hi) | Clamp every element of A into [lo,hi] |
mpower | mpower(A,n) | Matrix power A^n (square A, integer n; negative uses inverse) |
sign | sign(A) | -1, 0 or 1 per element (NaN stays NaN) |
floor | floor(A) | Element-wise round toward minus infinity |
ceil | ceil(A) | Element-wise round toward plus infinity |
fix | fix(A) | Element-wise round toward zero |
round | round(A[,n[,"significant"]]) | Round half away from zero; n decimal places, or n significant digits |
sec | sec(A) | Element-wise secant, 1/cos (radians) |
csc | csc(A) | Element-wise cosecant, 1/sin (radians) |
cot | cot(A) | Element-wise cotangent, 1/tan (radians) |
sinh | sinh(A) | Element-wise hyperbolic sine |
cosh | cosh(A) | Element-wise hyperbolic cosine |
tanh | tanh(A) | Element-wise hyperbolic tangent |
deg2rad | deg2rad(A) | Degrees to radians |
rad2deg | rad2deg(A) | Radians to degrees |
expm1 | expm1(A) | exp(A)-1, keeping the digits near zero |
log1p | log1p(A) | log(1+A), keeping the digits near zero; refuses below -1 |
sind | sind(A) | Sine of an angle in DEGREES; sind(180) is exactly 0 |
cosd | cosd(A) | Cosine of an angle in degrees; cosd(90) is exactly 0 |
tand | tand(A) | Tangent of an angle in degrees; tand(90) is Inf |
secd | secd(A) | Secant of an angle in degrees, 1/cosd |
cscd | cscd(A) | Cosecant of an angle in degrees, 1/sind |
cotd | cotd(A) | Cotangent of an angle in degrees, 1/tand |
asind | asind(A) | Arcsine in degrees; refuses outside [-1,1] |
acosd | acosd(A) | Arccosine in degrees; refuses outside [-1,1] |
atand | atand(A) | Arctangent in degrees |
asin | asin(A) | Arcsine in radians; refuses outside [-1,1] |
acos | acos(A) | Arccosine in radians; refuses outside [-1,1] |
atan | atan(A) | Arctangent in radians |
asec | asec(A) | Arcsecant, acos(1/A); refuses inside (-1,1) |
acsc | acsc(A) | Arccosecant, asin(1/A); refuses inside (-1,1) |
acot | acot(A) | Arccotangent, atan(1/A); acot(0) is pi/2 and acot(-0) is -pi/2 |
sech | sech(A) | Hyperbolic secant, 1/cosh |
csch | csch(A) | Hyperbolic cosecant, 1/sinh; csch(0) is Inf |
coth | coth(A) | Hyperbolic cotangent, 1/tanh; coth(0) is Inf |
asinh | asinh(A) | Inverse hyperbolic sine |
acosh | acosh(A) | Inverse hyperbolic cosine; refuses below 1 |
atanh | atanh(A) | Inverse hyperbolic tangent; atanh(1) is Inf, refuses outside [-1,1] |
asech | asech(A) | Inverse hyperbolic secant, acosh(1/A); asech(0) is Inf, refuses outside [0,1] |
acsch | acsch(A) | Inverse hyperbolic cosecant, asinh(1/A); acsch(0) is Inf |
acoth | acoth(A) | Inverse hyperbolic cotangent, atanh(1/A); acoth(1) is Inf, refuses inside (-1,1) |
erf | erf(A) | Error function |
erfc | erfc(A) | Complementary error function, 1-erf(A) |
erfinv | erfinv(A) | Inverse error function; NaN outside [-1,1], as in MATLAB |
erfcinv | erfcinv(A) | Inverse complementary error function; NaN outside [0,2] |
gamma | gamma(A) | Gamma function; Inf at every non-positive integer |
gammaln | gammaln(A) | log(gamma(A)) without the overflow; refuses a negative entry |
gammainc | gammainc(x,a[,"upper"]) | Regularized incomplete gamma, lower tail by default |
gammaincinv | gammaincinv(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 |
beta | beta(a,b) | Beta function, exp(betaln(a,b)) |
betaln | betaln(a,b) | log(beta(a,b)) without the overflow |
betainc | betainc(x,a,b[,"upper"]) | Regularized incomplete beta; x must be in [0,1] |
betaincinv | betaincinv(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 |
hypot | hypot(a,b) | sqrt(a^2 + b^2) without intermediate overflow (a scalar broadcasts) |
atan2 | atan2(y,x) | Four-quadrant arctangent of y/x, in (-pi, pi] |
mod | mod(a,m) | Remainder after division, sign following the DIVISOR; mod(a,0) is a |
rem | rem(a,m) | Remainder after division, sign following the DIVIDEND; rem(a,0) is NaN |
gcd | gcd(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 |
lcm | lcm(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 |
factorial | factorial(n) | n! per element (n a non-negative integer) |
nchoosek | nchoosek(n,k) | Binomial coefficient for scalar n; every k-combination as rows for a vector |
nthroot | nthroot(x,n) | Real n-th root; a negative x needs an odd integer n |
realsqrt | realsqrt(A) | Square root, refusing a negative entry instead of going complex |
reallog | reallog(A) | Natural logarithm, refusing a negative entry instead of going complex |
realpow | realpow(a,b) | Power, refusing a negative base with a fractional exponent |
gt | gt(A,B) | Element-wise A > B (the function form of >) |
lt | lt(A,B) | Element-wise A < B (the function form of <) |
ge | ge(A,B) | Element-wise A >= B (the function form of >=) |
le | le(A,B) | Element-wise A <= B (the function form of <=) |
eq | eq(A,B) | Element-wise A == B, exactly (the function form of ==) |
ne | ne(A,B) | Element-wise A ~= B, exactly (the function form of ~=) |
rand | rand / rand(n) / rand(m,n) / rand([m n]) | Uniform random in [0,1): a scalar, n x n, or m x n |
randn | randn / randn(n) / randn(m,n) | Standard normal random, same size forms as rand |
randi | randi(imax[,m[,n]]) / randi([a b],...) | Whole numbers drawn uniformly from 1..imax, or from the closed range [a b] |
randperm | randperm(n[,k]) | k values drawn from 1..n without replacement, as a row; k defaults to n (the full permutation) |
rng | rng / 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) |
tic | tic | Start the stopwatch; answers 0, because MATLAB's tic yields no value and every console expression must yield one |
toc | toc | Seconds since the last tic -- MATLAB's t = toc |
sum | sum(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 |
mean | mean(A[,dim]) / mean(A,"all") | Mean down each column (or along dim), or of every element with "all"; same NaN rule as sum |
max | max(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 |
min | min(A[,[],dim]) / min(A,B) / [m,i] = min(A) | Smallest, in every form max takes |
norm | norm(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) |
vecnorm | vecnorm(A[,p[,dim]]) | p-norm of each column (dim 1) or row (dim 2); defaults are p = 2 and the first non-singleton dimension |
normfro | normfro(A) | Frobenius norm (extra: norm(A, "fro")) |
normrms | normrms(A) | RMS norm |
norm1 | norm1(A) | 1-norm (max absolute column sum) |
norm2 | norm2(A) | 2-norm (largest singular value, power iteration) |
norminf | norminf(A) | Infinity norm (max absolute row sum) |
nucnorm | nucnorm(A) | Nuclear norm (sum of singular values) |
sumrows | sumrows(A) | Sum of each row, as a column vector |
sumcols | sumcols(A) | Sum of each column, as a row vector |
meanrows | meanrows(A) | Mean of each row, as a column vector |
meancols | meancols(A) | Mean of each column, as a row vector |
maxrows | maxrows(A) | Largest element of each row, as a column vector |
maxcols | maxcols(A) | Largest element of each column, as a row vector |
minrows | minrows(A) | Smallest element of each row, as a column vector |
mincols | mincols(A) | Smallest element of each column, as a row vector |
cumsum | cumsum(A[,dim]) | Running sum along dim (1 = down the columns, 2 = along the rows); default is the first dimension with more than one entry |
cumprod | cumprod(A[,dim]) | Running product along dim; same default as cumsum |
cummax | cummax(A[,dim]) | Running largest-so-far along dim; a NaN reports the running maximum rather than spreading |
cummin | cummin(A[,dim]) | Running smallest-so-far along dim; a NaN reports the running minimum rather than spreading |
reshape | reshape(A,r,c) / reshape(A,[r c]) | Reshape A into r x c, reading and writing down the COLUMNS (MATLAB's element order) |
flipud | flipud(A) | Flip A vertically (reverse row order) |
fliplr | fliplr(A) | Flip A horizontally (reverse column order) |
flip | flip(A[,dim]) | Reverse A along dim (1 = rows, 2 = columns); default is the first dimension with more than one entry |
isempty | isempty(A) | 1 when A has no entries -- always 0 until the console has an empty matrix |
isscalar | isscalar(A) | 1 when A is 1 x 1 |
isvector | isvector(A) | 1 when A is 1 x n or n x 1 |
isrow | isrow(A) | 1 when A is 1 x n |
iscolumn | iscolumn(A) | 1 when A is n x 1 |
ismatrix | ismatrix(A) | 1 when A is 2-D -- true of everything the console holds |
isdiag | isdiag(A) | 1 when every off-diagonal entry is exactly zero |
istriu | istriu(A) | 1 when every entry below the main diagonal is exactly zero |
istril | istril(A) | 1 when every entry above the main diagonal is exactly zero |
isbanded | isbanded(A,lo,up) | 1 when every non-zero entry lies within lo bands below and up above the main diagonal |
linsolve | linsolve(A,b) | Solve A*x = b -- MATLAB's name for solve() and the backslash operator |
lsqnonneg | lsqnonneg(C,d) | Least-squares solution of C*x = d over x >= 0, by the Lawson-Hanson active-set algorithm |
optimoptions | optimoptions(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 |
optimset | optimset([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 |
lsqminnorm | lsqminnorm(A,b) | Of all the least-squares solutions of A*x = b, the one of smallest norm |
condest | condest(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 |
normest | normest(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 |
cholupdate | cholupdate(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 |
gsvd | gsvd(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 |
polyeig | polyeig(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 |
lscov | lscov(A,b[,w]) | Ordinary or weighted least squares; a rank-deficient A is refused, not answered with a basic solution |
rot90 | rot90(A[,k]) | Rotate A a quarter turn counter-clockwise, k times (k may be negative) |
circshift | circshift(A,k[,dim]) | Shift A circularly by k along dim; circshift(A,[r c]) shifts both |
triu | triu(A[,k]) | Upper triangle of A on and above the k-th diagonal (k defaults to 0) |
tril | tril(A[,k]) | Lower triangle of A on and below the k-th diagonal (k defaults to 0) |
blkdiag | blkdiag(A,B[,C]) | Block-diagonal matrix built from the operands, zeros elsewhere |
diff | diff(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 |
numel | numel(A) | Number of entries in A |
length | length(A) | Longest dimension of A (0 when A is empty) |
ndims | ndims(A) | Number of dimensions of A -- 2 for every matrix the console holds |
nnz | nnz(A) | Count of non-zero entries in A |
nonzeros | nonzeros(A) | Non-zero entries of A as a column, in column-major order |
sort | sort(A[,dim[,mode]]) | Sort along dim (default: the first dimension with more than one entry); mode is "ascend" or "descend" |
sortrows | sortrows(A[,cols]) | Order whole rows by the given 1-based columns, a negative column sorting descending on it |
unique | unique(A[,mode]) | Sorted distinct values; mode is "rows" or "stable" (first-appearance order) |
find | find(A[,n[,mode]]) | 1-based column-major indices of the non-zero entries; mode is "first" or "last" |
sub2ind | sub2ind([r c],i,j) | Column-major linear index of a subscript pair, 1-based |
ind2sub | ind2sub([r c],k) | MATLAB's one-output form: the index unchanged (the useful [r,c] form needs multiple outputs) |
ismember | ismember(A,S[,"rows"]) | 1 where A's entry (or row) appears in S |
union | union(A,B[,mode]) | Distinct values in either, sorted; mode is "rows" or "stable" |
intersect | intersect(A,B[,mode]) | Distinct values in both, sorted |
setdiff | setdiff(A,B[,mode]) | Distinct values of A that are not in B |
setxor | setxor(A,B[,mode]) | Distinct values in exactly one of the two |
repmat | repmat(A,n) / repmat(A,[m n]) / repmat(A,r,c) | Tile A: n x n times, or r times vertically and c horizontally |
eye | eye(n) / eye(m,n) / eye([m n]) | Identity: ones on the main diagonal, zeros elsewhere |
magic | magic(n) | MATLAB's n x n magic square (rows, columns and both diagonals sum alike; n = 2 is MATLAB's degenerate square) |
colon | colon(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 |
squeeze | squeeze(A) | Drop the dimensions of extent 1 -- the identity on a 2-D matrix, which is all this console holds |
permute | permute(A,[2 1]) | Reorder the dimensions; over two dimensions [2 1] is the transpose and [1 2] the identity |
ipermute | ipermute(A,[2 1]) | Inverse of permute; over two dimensions it is permute itself |
prod | prod(A[,dim]) / prod(A,"all") | Product down each column (or along dim), or of every entry with "all" |
ones | ones(n) / ones(m,n) / ones([m n]) | Matrix of ones: n x n, or m x n |
accumarray | accumarray(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 |
histcounts | histcounts(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 |
trapz | trapz(y) / trapz(x,y) / trapz(y,dim) / trapz(x,y,dim) | Trapezoidal integral along dim, over unit spacing or the grid x |
cumtrapz | cumtrapz(y) / cumtrapz(x,y[,dim]) | Running trapezoidal integral, starting at 0 and keeping the shape of y |
feval | feval(f,a1,...) | Call the function handle f (or the function named by a character vector) with the arguments given |
func2str | func2str(f) | The source text of a function handle. The console answers it AS WRITTEN, where MATLAB reprints it from its own parse |
str2func | str2func(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 |
arrayfun | arrayfun(f,A,...) | f applied to every element, answering an array of the same shape. "UniformOutput", false needs cell arrays and is refused (C12.1) |
fzero | fzero(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 |
fminbnd | fminbnd(f,a,b) | The minimiser of f inside [a,b], by golden section with parabolic interpolation |
fminsearch | fminsearch(f,x0) / [x,fval] = fminsearch(f,x0) | The minimiser of f found by the Nelder-Mead simplex from x0, whose SHAPE the search keeps |
fmincon | fmincon(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) |
integral | integral(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 |
quadgk | quadgk(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 |
integral2 | integral2(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 |
integral3 | integral3(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) |
odeset | odeset("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 |
odeget | odeget(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 |
quad | quad(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 |
quadl | quadl(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 |
orth | orth(A[,tol]) | Orthonormal basis for the range of A, as columns -- the leading rank(A) left singular vectors |
linspace | linspace(a,b[,n]) | n evenly spaced points from a to b, as a ROW vector; n defaults to 100 |
meshgrid | meshgrid(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 |
ndgrid | ndgrid(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 |
logspace | logspace(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 |
conv | conv(u,v[,shape]) | Convolution of two vectors (polynomial multiplication); shape is "full" (default), "same" or "valid" |
conv2 | conv2(A,B[,shape]) | Two-dimensional convolution; same three shapes |
filter2 | filter2(h,A[,shape]) | Correlate A with kernel h -- conv2 with h turned a half-turn; shape defaults to "same" |
filter | filter(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 |
polyval | polyval(p,x) | Evaluate the polynomial p at every entry of x |
polyvalm | polyvalm(p,A) | Evaluate p IN the square matrix A (x^2 is A*A, and the constant term is that multiple of the identity) |
polyint | polyint(p[,k]) | Coefficients of the integral of p, with constant of integration k (default 0) |
polyder | polyder(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 |
deconv | deconv(b,a) | Polynomial long division: the quotient of b by a, and [q, r] = deconv(b, a) the remainder too, as long as b |
spline | spline(x,y,xq) | Not-a-knot cubic spline through (x,y), evaluated at xq (extrapolates by continuing the end cubic) |
pchip | pchip(x,y,xq) | Shape-preserving cubic through (x,y) at xq -- never overshoots between samples |
median | median(A[,dim][,"omitnan"]) | Median down each column; a NaN makes the answer NaN unless omitted |
std | std(A[,w][,dim]) | Standard deviation; w is 0 (default, N-1), 1 (N), or a vector of weights |
var | var(A[,w][,dim]) | Variance; w is 0 (default, N-1), 1 (N), or a vector of weights |
corr | corr(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 |
partialcorr | partialcorr(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 |
rotatefactors | rotatefactors(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 |
corrcoef | corrcoef(A) / corrcoef(x,y) | Correlation matrix of A's columns, or the 2x2 correlation of two vectors |
rescale | rescale(A[,l,u]) | Scale the whole array onto [l,u] (default [0,1]) from its own min and max |
movmean | movmean(A,k[,dim]) | Moving average over a k-wide window |
movsum | movsum(A,k[,dim]) | Moving sum over a k-wide window |
movmedian | movmedian(A,k[,dim]) | Moving median over a k-wide window |
movmax | movmax(A,k[,dim]) | Moving maximum over a k-wide window |
movmin | movmin(A,k[,dim]) | Moving minimum over a k-wide window |
movstd | movstd(A,k[,w]) | Moving standard deviation; w is 0 (default, N-1) or 1 (N) |
movvar | movvar(A,k[,w]) | Moving variance; w is 0 (default, N-1) or 1 (N) |
size | size(A[,dim]) | Size of A as [rows cols]; [m, n] = size(A) splits it |
bounds | bounds(A[,"all"]) | Column-wise minimum; [lo, hi] = bounds(A) answers both |
mode | mode(A[,dim]) | Most frequent value down each column, ties going to the smallest |
isnan | isnan(A) | 1 where an entry is NaN |
isinf | isinf(A) | 1 where an entry is +Inf or -Inf |
isfinite | isfinite(A) | 1 where an entry is neither infinite nor NaN |
any | any(A[,dim]) | 1 where a column holds a non-zero entry; NaN does not count |
all | all(A[,dim]) | 1 where every entry of a column is non-zero; NaN is skipped |
and | and(a,b) | Element-wise logical AND (the function form of &); a scalar operand broadcasts |
or | or(a,b) | Element-wise logical OR (the function form of \|); a scalar operand broadcasts |
xor | xor(a,b) | Element-wise exclusive OR; a scalar operand broadcasts |
not | not(a) | 1 where an entry is zero, 0 elsewhere (the function form of ~) |
isequal | isequal(A,B,...) | 1 when every argument has the same shape and entries (NaN is never equal) |
isequaln | isequaln(A,B,...) | isequal, but NaN counts as equal to NaN |
issorted | issorted(A[,"rows"]) | 1 when each column is non-decreasing (NaN sorts last) |
primes | primes(n) | Every prime up to n, as a row vector |
isprime | isprime(X) | 1 where an entry is prime; the entries must be non-negative integers |
class | class(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 |
isnumeric | isnumeric(x) | 1 when x is a matrix -- the console's only numeric kind (there are no integer or single types) |
isfloat | isfloat(x) | 1 when x is a matrix; every console number is a double |
isinteger | isinteger(x) | Always 0: the console has no integer types |
ischar | ischar(x) | 1 when x is a string, which crosses to MATLAB as a char array |
islogical | islogical(x) | 1 when x is a logical array -- what a comparison, a connective, any/all and every is* question answers (C9.4) |
logical | logical(A) | A as a logical array: every non-zero entry becomes 1. A NaN is refused rather than converted, as in MATLAB |
isstring | isstring(x) | Always 0: the console has no MATLAB string class, only char |
iscell | iscell(x) | Always 0: the console has no cell arrays |
isstruct | isstruct(x) | Always 0: the console has no structs |
isa | isa(x,"class") | 1 when class(x) is that name, or when x is a matrix and the name is "numeric" or "float" |
factor | factor(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 |
unit | unit(v) | Unit vector v / \|\|v\|\| -- the console's own, which held the name normalize until C6.8 |
normalize | normalize(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 |
vecangle | vecangle(a,b) | Angle between two vectors, in radians (MATLAB's angle() is complex phase, which angle(z) now answers) |
sylvester | sylvester(A,B,C) | Solves A*X + X*B = C |
fftshift | fftshift(A[,dim]) | Swap the halves of each dimension so the zero-frequency term sits in the centre |
ifftshift | ifftshift(A[,dim]) | Undo fftshift; the two differ only for an odd length |
fft | fft(x[,n[,dim]]) | Discrete Fourier transform, down the columns by default; n pads or truncates |
fft2 | fft2(A) | Two-dimensional DFT: fft along the columns and then along the rows |
ifft2 | ifft2(A) | Inverse of fft2 |
real | real(z) | Real part |
imag | imag(z) | Imaginary part (0 for a real argument) |
conj | conj(z) | Complex conjugate |
angle | angle(z) | Phase in radians, atan2(imag, real) -- 0 for a positive real, pi for a negative one |
complex | complex(a[,b]) | Build a complex value that stays complex: isreal(complex(3,0)) is 0, unlike 3 + 0i |
isreal | isreal(x) | 1 when the value is stored as real -- a question about the STORAGE, so isreal(complex(3,0)) is 0 |
iscomplex | iscomplex(x) | The negation of isreal |
ifft | ifft(X[,n]) / ifft(X,"symmetric") | Inverse DFT; a conjugate-symmetric spectrum answers a REAL signal, as MATLAB's does |
fftmag | fftmag(x) | Magnitude of fft(x) |
fftphase | fftphase(x) | Phase (radians) of fft(x) |
interp1 | interp1(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 |
interp2 | interp2(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 |
polyfit | polyfit(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 |
quat2rotm | quat2rotm(q) | Quaternion to 3x3 rotation matrix |
rotm2quat | rotm2quat(R) | 3x3 rotation matrix to quaternion |
tfest | tfest(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 |
n4sid | n4sid(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 |
sym | sym(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 |
syms | syms x y z | Declare 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 |
taylor | taylor(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) |
solve | solve(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) |
dirac | dirac(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) |
del2 | del2(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 |
divergence | divergence([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 |
curl | curl([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 |
detrend | detrend(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 |
xcorr | xcorr(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 |
xcov | xcov(x[,y][,maxlag][,scale]) | Cross-covariance: xcorr of the MEAN-REMOVED signals, same arguments and same scales. [c, lags] = xcov(...) reports the lags |
prctile | prctile(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 |
quantile | quantile(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) |
iqr | iqr(x[,dim]) | Interquartile range: the 75th percentile less the 25th, through prctile's rule |
range | range(x[,dim]) | Largest less smallest. max(A) - min(A) is the core spelling of the same answer |
mad | mad(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 |
zscore | zscore(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 |
skewness | skewness(x[,flag[,dim]]) | Third standardised central moment. flag 1 (the DEFAULT, unlike std) is biased; flag 0 corrects, and is NaN below 3 samples |
kurtosis | kurtosis(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 |
moment | moment(x,order[,dim]) | The central moment of that order, always about the biased mean. Order 1 is exactly 0 by definition |
knnsearch | knnsearch(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 |
normcdf | normcdf(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. |
mle | mle(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 |
cdf | cdf(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 |
icdf | icdf(name, p[, a, b, c, d]) | The quantile of a named distribution -- the inverse of cdf. The same zero-fill and prefix rule |
robustfit | robustfit(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 |
glmfit | glmfit(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 |
glmval | glmval(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 |
nlpredci | nlpredci(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 |
stepwisefit | stepwisefit(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 |
lasso | lasso(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 |
smooth | smooth([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 |
fit | fit(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 |
fitoptions | fitoptions([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" |
spaps | spaps(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. |
linkage | linkage(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 |
cluster | cluster(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 |
clusterdata | clusterdata(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 |
signtest | signtest(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 |
signrank | signrank(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 |
ranksum | ranksum(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 |
vartest | vartest(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 |
vartest2 | vartest2(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 |
chi2gof | chi2gof(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 |
runstest | runstest(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 |
ecdf | ecdf(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 |
ksdensity | ksdensity(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 |
jackknife | jackknife(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 |
bootstrp | bootstrp(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 |
bootci | bootci(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 |
datasample | datasample(data,k[,dim][,"Replace",tf][,"Weights",w]) | k rows (dim 1, the default) or columns (dim 2) drawn from data, WITH replacement by default |
idinput | idinput(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 |
dct | dct(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 |
idct | idct(y[,n][,"Type",t]) | Inverse discrete cosine transform -- the forward matrix transposed, which is what orthonormal buys |
czt | czt(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 |
freqz | freqz(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 |
rms | rms(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 |
obw | obw(x[,fs[,[],P]]) | Occupied bandwidth: the band holding P percent of the power (99 by default). [bw, flo, fhi, pwr] = obw(...) reports the band |
powerbw | powerbw(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 |
periodogram | periodogram(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 |
pwelch | pwelch(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 |
cpsd | cpsd(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 |
mscohere | mscohere(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 |
tfestimate | tfestimate(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 |
spectrogram | spectrogram(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 |
fir1 | fir1(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 |
fir2 | fir2(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 |
findpeaks | findpeaks(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 |
gradient | gradient(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 |
poly | poly(A) / poly(r) | Characteristic polynomial as a coefficient ROW: of a square matrix, or of a vector of roots |
polynomial | polynomial([..]) | Polynomial value from descending coefficients (the console's own constructor; MATLAB has no object for it) |
timeSeries | timeSeries(time,values) | Time series from an N-element time vector and an N x M value matrix |
time | series.time() | Time vector of a time series, as an N x 1 matrix |
values | series.values() | Value block of a time series, as an N x M matrix |
grpdelay | grpdelay(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 |
phasez | phasez(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 |
roots | roots(p) | Roots of a polynomial / coefficient vector, as a column -- complex when they are, real when every root is |
zeros | zeros(n) / zeros(m,n) / zeros([m n]) | Matrix of zeros: n x n, or m x n |
kalman | kalman(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 |
pid | pid(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 |
pidstd | pidstd(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 |
pidtuneOptions | pidtuneOptions(["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 |
append | append(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 |
ttest2 | ttest2(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 |
sprintf | sprintf(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 |
num2str | num2str(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 |
int2str | int2str(x) | x rounded to whole numbers (half away from zero) as text |
mat2str | mat2str(A[,n]) | A as text that reads back as an expression: "[1 2;3 4]"; 15 significant digits by default |
str2double | str2double(s) | The one number s spells, or NaN -- embedded commas are dropped, "Inf"/"NaN" and a 0x prefix are read |
str2num | str2num(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 |
string | string(x) | x as text, the same as num2str(x) |
char | char(A) | Code points as characters: char([72 73]) is "HI". Truncates toward zero, as MATLAB does |
double | double(s) / double(A) | The code points of a string as a 1 x n row; a logical array as ordinary numbers |
regexp | regexp(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 |
regexpi | regexpi(s,pat[,...]) | regexp ignoring case |
regexprep | regexprep(s,pat,rep) | Every match of pat in s replaced by rep, where $1 is the first group and $0 the whole match |
strcat | strcat(s1,s2,...) | Join strings, dropping each one's TRAILING whitespace (MATLAB's rule); [s1 s2] keeps it |
strcmp | strcmp(a,b) | 1 when a and b are the same string; 0 for any other pair, including two numbers |
strcmpi | strcmpi(a,b) | strcmp ignoring case |
strncmp | strncmp(a,b,n) | 1 when the first n characters match; 0 when either string is shorter than n |
strncmpi | strncmpi(a,b,n) | strncmp ignoring case |
upper | upper(s) | s in upper case |
lower | lower(s) | s in lower case |
strtrim | strtrim(s) | s without leading or trailing whitespace |
deblank | deblank(s) | s without TRAILING whitespace only |
blanks | blanks(n) | A string of n spaces |
newline | newline | The newline character, as a one-character string |
strlength | strlength(s) | The number of characters in s; length(s) and numel(s) answer the same |
strfind | strfind(s,pattern) | Every 1-based start position, OVERLAPPING: strfind("aaa","aa") is [1 2]; no match is the 0 x 0 empty matrix |
strrep | strrep(s,old,new) | Replace at every position strfind reports, overlaps included: strrep("aaaa","aa","b") is "bbb" |
replace | replace(s,old,new) | Replace scanning left to right without overlaps: replace("aaaa","aa","b") is "bb" |
contains | contains(s,pattern) | 1 when pattern occurs in s |
startsWith | startsWith(s,pattern) | 1 when s begins with pattern |
endsWith | endsWith(s,pattern) | 1 when s ends with pattern |
extractBefore | extractBefore(s,pattern|position) | The part of s before the first occurrence of pattern, or before a 1-based position |
extractAfter | extractAfter(s,pattern|position) | The part of s after the first occurrence of pattern, or after a 1-based position |
gauspuls | gauspuls(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) |
chirp | chirp(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.
| Function | Signature | Row | Meaning |
|---|---|---|---|
lyap | lyap(A,Q) / lyap(A,B,C) / lyap(A,Q,[],E) | landed | Continuous 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 |
dlyap | dlyap(A,Q) / dlyap(A,B,C) / dlyap(A,Q,[],E) | landed | Discrete Lyapunov: solves A*X*A' - X + Q = 0; A*X*B - X + C = 0; A*X*A' - E*X*E' + Q = 0 |
icare | icare(A,B,Q[,R]) / [X,K,L] = icare(...) | landed | Continuous 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() |
idare | idare(A,B,Q,R) / [X,K,L] = idare(...) | landed | Discrete 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 |
care | care(A,B,Q[,R]) / [X,L,G] = care(...) | landed | The 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 |
dare | dare(A,B,Q,R) / [X,L,G] = dare(...) | landed | The pre-R2019a spelling of idare(), with the same [X,L,G] order care() has |
freqresp | freqresp(sys,w) | landed | G 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 |
evalfr | evalfr(sys,x) | landed | G 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 |
bandwidth | bandwidth(sys[,dbdrop]) | landed | The 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 |
getPeakGain | getPeakGain(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 |
series | series(sys1,sys2) | landed | sys1 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 |
parallel | parallel(sys1,sys2) | landed | The two systems side by side over one input: sys1 + sys2 |
feedback | feedback(G,H[,sign]) | landed | The 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 |
zpk | zpk(z,p,k[,Ts]) / zpk('s') / zpk('z',Ts) / zpk(sys) / zpk(k) | landed | Zero/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 |
tf | tf(num,den[,Ts]) / tf('s') / tf('z',Ts) / tf(sys) / tf(k) | landed | Transfer 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 |
ss | ss(A,B,C,D[,Ts]) / ss(sys) | landed | State-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 |
tfdata | tfdata(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 |
zpkdata | zpkdata(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 |
ssdata | ssdata(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 |
pole | pole(G|sys) | landed | Poles of a transfer function or state-space model |
zero | zero(G) | landed | Transmission zeros of a transfer function |
pzmap | pzmap(sys) / [p, z] = pzmap(sys) | landed | Poles and zeros of a model: one output is the POLES, two are [p, z]; the bare statement draws the pole-zero map |
dcgain | dcgain(G) | extra | DC gain of a transfer function |
isstable | isstable(G|p) | extra | 1 if stable, else 0 |
damp | damp(sys) / [wn, zeta, p] = damp(sys) | landed | Natural frequencies (rad/s), damping ratios and poles, sorted by increasing frequency |
order | order(sys) | landed | Number of states: the denominator degree of a proper transfer function |
isct | isct(sys) | landed | 1 for a continuous-time (or static) model |
isdt | isdt(sys) | landed | 1 for a discrete-time (or static) model |
isproper | isproper(sys) | landed | 1 when the numerator degree does not exceed the denominator's |
issiso | issiso(sys) | landed | 1 for a single-input single-output model |
minreal | minreal(G[, tol]) | landed | Cancels pole/zero pairs matching to within tol relative to the pole (default sqrt(eps)) |
d2c | d2c(sysd[, method]) | landed | Discrete model back to continuous time: "zoh" (default) or "tustin" |
d2d | d2d(sysd, Ts) | landed | Re-samples a discrete model at a new sample time |
c2d | c2d(sys, Ts[, method]) | landed | Continuous model to discrete: "zoh" (default), "foh", "tustin" or "impulse". "matched" is refused -- the routine behind it is the zoh routine |
ss2ss | ss2ss(sys, T) | landed | The same model in the state basis xbar = T*x |
canon | canon(sys, "companion") / [csys, T] = canon(...) | landed | The 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 |
balreal | balreal(sys) / [sysb, g, T, Ti] = balreal(sys) | landed | The balanced realization, in which both gramians equal diag(g) -- the Hankel singular values, the energy each mode carries. Stable, minimal models only |
modred | modred(sys, elim[, "MatchDC"|"Truncate"]) | landed | Removes the listed states. MatchDC (the default) solves them out and keeps the DC gain exactly; Truncate simply deletes them |
lqe | lqe(A, G, C, Q, R[, N]) / [L, P, E] = lqe(...) | landed | The 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 |
estim | estim(sys, L) | landed | The estimator for a gain you already have. Its inputs are the MEASUREMENTS alone -- MATLAB treats no plant input as known unless told |
pidtune | pidtune(sys, type[, wc][, opts]) / [C, info] = pidtune(...) | landed | Tune 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 |
margin | margin(sys) / [Gm, Pm, Wcg, Wcp] = margin(sys) | landed | Stability 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 |
pade | pade(tau, n) / [num, den] = pade(tau, n) | landed | Coefficient 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 |
covar | covar(sys, W) / [P, Q] = covar(sys, W) | landed | Steady-state output (and state) covariance under white noise of intensity W |
ctrb | ctrb(sys) | landed | Controllability matrix |
obsv | obsv(sys) | landed | Observability matrix |
bode | bode(sys[,w|wmin,wmax]) / [m,p,w] = bode(...) / bode(G,wStart,wEnd,n) | landed | Frequency 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 |
bodemag | bodemag(sys[,w|wmin,wmax]) | landed | Draws the magnitude alone. It has no value form on either side -- m = bode(sys) is the magnitude as a value |
nyquist | nyquist(sys[,w|wmin,wmax]) / [re,im,w] = nyquist(...) / nyquist(G,wStart,wEnd,n) | landed | G(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 |
nichols | nichols(sys[,w|wmin,wmax]) / [m,p,w] = nichols(...) | landed | bode'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 |
sigma | sigma(sys[,w|wmin,wmax]) / [sv,w] = sigma(...) | landed | Singular 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 |
rlocus | rlocus(sys,k) / [r,k] = rlocus(sys,k) | landed | Closed-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 |
lqr | lqr(A,B,Q,R[,N]) / lqr(sys,Q,R[,N]) / [K,S,P] = lqr(...) | landed | Linear-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 |
dlqr | dlqr(A,B,Q,R[,N]) / [K,S,P] = dlqr(...) | landed | The discrete regulator over matrices: the same design lqr() does for a model with a sample time |
lqi | lqi(sys,Q,R[,N]) / [K,S,P] = lqi(...) | landed | The 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 |
lqry | lqry(sys,Q,R[,N]) / [K,S,P] = lqry(...) | landed | The 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 |
ctrbf | ctrbf(A,B,C[,tol]) / [Abar,Bbar,Cbar,T,k] = ctrbf(...) | landed | Controllability staircase: an ORTHOGONAL change of basis separating the uncontrollable modes (leading block) from the controllable ones. sum(k) is the controllable rank |
obsvf | obsvf(A,B,C[,tol]) / [Abar,Bbar,Cbar,T,k] = obsvf(...) | landed | Observability staircase -- the same routine on the dual system |
gram | gram(sys,"c"|"o") | landed | Controllability or observability gramian: the Lyapunov solution A*Wc + Wc*A' + B*B' = 0 (or its discrete twin), which exists only for a stable plant |
place | place(A,B,p) / [K,prec] = place(A,B,p) | landed | State-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 |
acker | acker(A,B,p) | landed | Ackermann'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 |
gensig | gensig(type,tau[,Tf[,Ts]]) / [u,t] = gensig(...) | landed | Control 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 |
rootlocus | rootlocus(G,gains) | extra | Closed-loop poles under unity feedback, swept over gains (Nx2 [real,imag]) |
step | step(sys[,Tfinal|t]) / [y,t,x] = step(...) / step(G,duration,points) | landed | Step 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 |
impulse | impulse(sys[,Tfinal|t]) / [y,t,x] = impulse(...) / impulse(G,duration,points) | landed | Impulse response, MATLAB's grid and MATLAB's 1/Ts discrete height; the three-argument form is the console's time series |
lsim | lsim(sys,u,t[,x0]) / [y,t,x] = lsim(...) | landed | Response 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 |
initial | initial(sys,x0[,Tfinal|t]) / [y,t,x] = initial(...) | landed | Free response of a state-space model from x0; a transfer function has no state to start from |
ramp | ramp(G[,duration[,points]]) / G.ramp(...) | extra | Ramp response as a time series; no duration picks one from the poles |
polezero | G.polezero() | extra | Plot 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.
| Function | Signature | Row | Meaning |
|---|---|---|---|
xcorr2 | xcorr2(A[,B]) | landed | 2-D cross-correlation of two matrices (the autocorrelation of one), (ma+mb-1) x (na+nb-1) with lag (0,0) at its centre |
cconv | cconv(a,b[,n]) | landed | Circular convolution of length n (default numel(a)+numel(b)-1, at which it is the linear one); a longer sequence WRAPS onto n samples |
finddelay | finddelay(x,y[,maxlag]) | landed | Delay 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 |
alignsignals | alignsignals(x,y[,maxlag][,'truncate']) | landed | Delay 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 |
sosfilt | sosfilt(sos,x) | landed | Cascade 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 |
fftfilt | fftfilt(b,x[,nfft]) | landed | FIR 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 |
medfilt1 | medfilt1(x[,n][,flags]) | landed | Running 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 |
sgolayfilt | sgolayfilt(x,order,frameLength[,w]) | landed | Savitzky-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 |
hampel | hampel(x[,k[,nsigma]]) | landed | Outlier 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 |
levinson | levinson(r[,n]) | landed | Levinson-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 |
ac2poly | ac2poly(r) | landed | The prediction-error polynomial of an autocorrelation -- levinson at full order. [a, efinal] adds the error |
poly2ac | poly2ac(a,efinal) | landed | The autocorrelation COLUMN a prediction-error polynomial came from; efinal is the FINAL prediction error and r0 comes back first |
poly2rc | poly2rc(a[,efinal]) | landed | Reflection coefficients of a prediction-error polynomial, as a column. [k, r0] adds the ZERO-LAG error |
rc2poly | rc2poly(k[,r0]) | landed | The prediction-error polynomial of a reflection sequence -- poly2rc backwards. [a, efinal] needs r0 to scale from |
lpc | lpc(x[,p]) | landed | Linear prediction coefficients of a signal by the Yule-Walker equations over its BIASED autocorrelation. [a, g] adds the error, which is aryule's e |
aryule | aryule(x,p) | landed | lpc's AR model with the reflection coefficients reported too: [a, e, k] |
arburg | arburg(x,p) | landed | AR model by Burg's lattice recursion, which minimises the forward and backward errors together: [a, e, k] |
arcov | arcov(x,p) | landed | AR model by the covariance method -- least squares over the un-windowed forward errors. [a, e] adds the noise variance |
armcov | armcov(x,p) | landed | AR model by the MODIFIED covariance method: arcov's solve over the forward and backward errors together |
lp2lp | lp2lp(b,a,Wo) | landed | Move an analog lowpass prototype to cutoff Wo (s -> s/Wo). One output is the numerator; [bt, at] is the pair |
lp2hp | lp2hp(b,a,Wo) | landed | Analog lowpass to HIGHPASS at Wo (s -> Wo/s) |
lp2bp | lp2bp(b,a,Wo,Bw) | landed | Analog lowpass to BANDPASS centred at Wo with bandwidth Bw; the order doubles |
lp2bs | lp2bs(b,a,Wo,Bw) | landed | Analog lowpass to BANDSTOP centred at Wo with bandwidth Bw; the order doubles |
bilinear | bilinear(b,a,fs[,fp]) / bilinear(z,p,k,fs[,fp]) | landed | Analog 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] |
impinvar | impinvar(b,a,fs[,tol]) | landed | Analog 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 |
goertzel | goertzel(x[,k]) | landed | The 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 |
butter | butter(n,Wn[,ftype][,'s']) | landed | Butterworth 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 |
cheby1 | cheby1(n,Rp,Wp[,ftype][,'s']) | landed | Chebyshev 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 |
cheby2 | cheby2(n,Rs,Ws[,ftype][,'s']) | landed | Chebyshev 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 |
ellip | ellip(n,Rp,Rs,Wp[,ftype][,'s']) | landed | Elliptic (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 |
besself | besself(n,Wo[,ftype]) | landed | Bessel 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 |
buttord | buttord(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 |
cheb1ord | cheb1ord(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 |
cheb2ord | cheb2ord(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 |
ellipord | ellipord(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 |
upsample | upsample(x,n[,phase]) | landed | n - 1 zeros inserted after every sample, starting at phase. EXACT on both sides -- nothing is computed |
downsample | downsample(x,n[,phase]) | landed | Every n-th sample from phase; the inverse of upsample at the same phase, and exact for the same reason |
decimate | decimate(x,r[,n][,"fir"]) | landed | Lowpass, 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 |
interp | interp(x,r[,n[,cutoff]]) | landed | Upsample 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 |
resample | resample(x,p,q[,n[,beta]]) | landed | Rate 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 |
upfirdn | upfirdn(x,h[,p[,q]]) | landed | Upsample 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 |
buttap | buttap(n) | landed | Butterworth 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 |
cheb1ap | cheb1ap(n,Rp) | landed | Chebyshev 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 |
cheb2ap | cheb2ap(n,Rs) | landed | Chebyshev II prototype: flat passband, ripple Rs dB in the STOPBAND, and zeros on the imaginary axis |
ellipap | ellipap(n,Rp,Rs) | landed | Elliptic prototype: ripple in BOTH bands and the steepest skirt an order can give. Rp must be above 0 and below Rs |
besselap | besselap(n) | landed | Bessel 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 |
peak2peak | peak2peak(x) | landed | max(x) - min(x) |
peak2rms | peak2rms(x) | landed | max(abs(x)) / rms(x) -- the crest factor |
rssq | rssq(x) | landed | Root sum of squares, sqrt(sum(x.^2)) -- the signal's Euclidean length |
bandpower | bandpower(x) / bandpower(x,fs,[flo fhi]) | landed | Average power. With no band it is mean(x.^2) EXACTLY -- no window, no transform; with one it integrates a Hamming periodogram over the band |
meanfreq | meanfreq(x[,fs]) | landed | The spectrum's centre of mass. [f, p] = meanfreq(...) adds the power in the band |
medfreq | medfreq(x[,fs]) | landed | The frequency that halves the spectrum's power, interpolated between bin MIDPOINTS so it lands between bins |
firls | firls(n,f,a[,w]) | landed | Least-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 |
kaiserord | kaiserord(f,a,dev[,fs]) | landed | Kaiser'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 |
sgolay | sgolay(order,frameLength[,w]) | landed | The 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!) |
firpm | firpm(n,f,a[,w]) | landed | Equiripple 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 |
firpmord | firpmord(f,a,dev[,fs]) | landed | Herrmann'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 |
pyulear | pyulear(x,order[,nfft[,fs]]) | landed | AR 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 |
pburg | pburg(x,order[,nfft[,fs]]) | landed | The same density over Burg's fit (arburg), which minimises the forward and backward prediction errors together |
pcov | pcov(x,order[,nfft[,fs]]) | landed | The same density over the covariance fit (arcov): least squares over the un-windowed data matrix, forward errors only |
pmcov | pmcov(x,order[,nfft[,fs]]) | landed | The same density over the modified covariance fit (armcov): forward and backward errors together, un-windowed |
hilbert | hilbert(x[,n]) | landed | The 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 |
envelope | envelope(x[,n,method]) | landed | Upper 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 |
freqs | freqs(b,a,w) | landed | Analog 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 |
tf2ss | tf2ss(G) / tf2ss(num,den) | landed | A MODEL's state-space realization; with two coefficient ROWS, MATLAB's controller canonical form [A, B, C, D] |
ss2tf | ss2tf(sys) / ss2tf(A,B,C,D[,iu]) | landed | A MODEL's transfer function; with the four state matrices, [num, den] from the iu'th input |
impz | impz(b,a[,n][,fs]) | landed | Impulse response and its time axis: [h, t]. Without n, MATLAB's impzlength picks the length from the filter's own poles |
stepz | stepz(b,a[,n][,fs]) | landed | Step response and its time axis: [s, t] -- impz with a step in |
tf2zp | tf2zp(num,den) | landed | Zeros, poles and gain of a coefficient pair: [z, p, k] |
zp2tf | zp2tf(z,p,k) | landed | The coefficient pair of a zero-pole-gain filter: [num, den] |
ss2zp | ss2zp(A,B,C,D[,iu]) | landed | Zeros, 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] |
zp2ss | zp2ss(z,p,k) | landed | The BALANCED second-order cascade of a zero-pole-gain filter: [A, B, C, D] -- pole pairs realized together, not the controller form |
tf2sos | tf2sos(b,a[,order]) | landed | Second-order sections of a coefficient pair: [sos, g]. order is "up" (default) or "down" |
zp2sos | zp2sos(z,p,k[,order]) | landed | Second-order sections of a zero-pole-gain filter: [sos, g], paired and ordered MATLAB's way |
ss2sos | ss2sos(A,B,C,D[,iu][,order]) | landed | Second-order sections of a realization: [sos, g] |
sos2tf | sos2tf(sos[,g]) | landed | The cascade multiplied back out: [b, a] |
sos2zp | sos2zp(sos[,g]) | landed | The cascade's own roots: [z, p, k] |
snr | snr(x[,fs[,n]]) / snr(x,y) / [r,noisePow] = snr(...) | landed | Signal-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 |
thd | thd(x[,fs[,n]]) / [r,harmPow,harmFreq] = thd(...) | landed | Total 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 |
sinad | sinad(x[,fs]) / [r,totDistPow] = sinad(...) | landed | Signal 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 |
sfdr | sfdr(x[,fs[,msd]]) / [r,spurPow,spurFreq] = sfdr(...) | landed | Spurious-free dynamic range in dB: the fundamental over the largest spur, wherever it is. msd excludes a band around the fundamental |
butterlp | butterlp(order,cutoffHz,fsHz) | extra | Discrete Butterworth lowpass transfer function |
butterhp | butterhp(order,cutoffHz,fsHz) | extra | Discrete Butterworth highpass transfer function |
butternotch | butternotch(order,centerHz,bandwidthHz,fsHz) | extra | Discrete Butterworth band-stop (notch) transfer function |
sawtooth | sawtooth(t[,width]) | landed | Sawtooth 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 |
square | square(t[,duty]) | landed | Square wave of period 2*pi over t: +1 for the first duty PERCENT of each period (default 50) and -1 for the rest |
sinc | sinc(x) | landed | The NORMALISED sinc, sin(pi*x)/(pi*x), which is 1 at 0 and 0 at every other whole number. Not sin(x)/x |
rectpuls | rectpuls(t[,w]) | landed | Unit-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 |
tripuls | tripuls(t[,w[,skew]]) | landed | Unit-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) |
pulstran | pulstran(t,d,p,...) | landed | Pulse 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 |
filtfilt | filtfilt(b,a,x) | landed | Zero-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 |
hann | hann(n[,sampling]) | landed | Hann (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) |
hamming | hamming(n[,sampling]) | landed | Hamming window, n x 1: 0.54 - 0.46*cos. Same sampling words as hann |
blackman | blackman(n[,sampling]) | landed | Blackman window, n x 1. Same sampling words as hann |
flattopwin | flattopwin(n[,sampling]) | landed | Flat-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 |
blackmanharris | blackmanharris(n[,sampling]) | landed | Minimum four-term Blackman-Harris window, n x 1. Same sampling words as hann |
nuttallwin | nuttallwin(n[,sampling]) | landed | Nuttall's minimum four-term Blackman-Harris window, n x 1. Same sampling words as hann |
bartlett | bartlett(n) | landed | Bartlett (triangular) window, n x 1, ZERO at both ends -- triang(n) is the same shape without the zeros |
triang | triang(n) | landed | Triangular window, n x 1, non-zero at both ends. bartlett(n) is the same shape with zero ends |
rectwin | rectwin(n) | landed | Rectangular window, n x 1 of ones -- the window you get by not windowing |
bohmanwin | bohmanwin(n) | landed | Bohman window, n x 1: the convolution of two half-cycle cosines, zero at both ends |
parzenwin | parzenwin(n) | landed | Parzen (de la Valle-Poussin) window, n x 1 -- the piecewise-cubic B-spline window |
gausswin | gausswin(n[,alpha]) | landed | Gaussian window, n x 1. alpha (default 2.5) is the RECIPROCAL of the standard deviation, so a larger alpha is a narrower window |
tukeywin | tukeywin(n[,r]) | landed | Tukey (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 |
kaiser | kaiser(n[,beta]) | landed | Kaiser window, n x 1. beta (default 0.5) trades main-lobe width against sidelobe height; beta = 0 is rectwin |
chebwin | chebwin(n[,r]) | landed | Dolph-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 |
window | window(f,n[,x]) | landed | The 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.
| Function | Signature | Row | Meaning |
|---|---|---|---|
cov | cov(A[,w]) / cov(x,y) | landed | Covariance matrix of A's columns (rows = observations); a vector gives its variance |
corrcov | corrcov(C) | landed | The correlation matrix of a covariance matrix, with exact ones on its diagonal; [R,sigma] adds the standard deviations it was scaled by |
tiedrank | tiedrank(x) | landed | Ranks 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 |
regress | regress(y,X[,alpha]) | landed | Least-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 |
pca | pca(X[,name,value]) | landed | Principal 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" |
pcacov | pcacov(C) | landed | Principal components of a COVARIANCE matrix through its SVD: [coeff,latent,explained], with pca's sign convention |
pcares | pcares(X,ndim) | landed | What 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 |
canoncorr | canoncorr(X,Y) | landed | Canonical 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 |
cmdscale | cmdscale(D[,p]) | landed | Classical (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 |
procrustes | procrustes(X,Y[,name,value]) | landed | The 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 |
geomean | geomean(x[,dim]) | landed | Geometric 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 |
harmmean | harmmean(x[,dim]) | landed | Harmonic mean: 1./mean(1./x), literally. A zero entry answers 0 rather than dividing by zero, because the infinity happens inside the mean |
trimmean | trimmean(x,percent[,flag][,dim]) | landed | Mean 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 |
tabulate | tabulate(x) | landed | The [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 |
crosstab | crosstab(x,y) | landed | Contingency 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 |
grpstats | grpstats(x,group) | landed | Group 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 |
pdist | pdist(X[,metric[,arg]]) | landed | Pairwise 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 |
pdist2 | pdist2(X,Y[,metric[,arg]]) | landed | Distances 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 |
squareform | squareform(v[,direction]) | landed | The 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 |
mahal | mahal(Y,X) | landed | The 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 |
normpdf | normpdf(x[,mu[,sigma]]) | landed | The 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. |
norminv | norminv(p[,mu[,sigma]]) | landed | The 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. |
normrnd | normrnd(mu,sigma[,m[,n]]) | landed | An 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. |
normfit | normfit(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. |
normlike | normlike([mu sigma],data) | landed | The 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. |
normstat | normstat(mu,sigma) | landed | [m, v] = the mean and VARIANCE of the normal distribution -- v is sigma^2, not sigma. |
tpdf | tpdf(x,v) | landed | The Student t density at x with v degrees of freedom. |
tcdf | tcdf(x,v[,"upper"]) | landed | The 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. |
tinv | tinv(p,v) | landed | The 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. |
trnd | trnd(v[,m[,n]]) | landed | An 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. |
chi2pdf | chi2pdf(x,v) | landed | The chi-square density at x with v degrees of freedom. It IS gampdf(x, v/2, 2) on both sides. |
chi2cdf | chi2cdf(x,v[,"upper"]) | landed | The 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. |
chi2inv | chi2inv(p,v) | landed | The chi-square quantile with v degrees of freedom: 2*gammaincinv(p, v/2), which is what gaminv(p, v/2, 2) is. |
chi2rnd | chi2rnd(v[,m[,n]]) | landed | An 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. |
fpdf | fpdf(x,v1,v2) | landed | The 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. |
fcdf | fcdf(x,v1,v2[,"upper"]) | landed | The 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. |
finv | finv(p,v1,v2) | landed | The 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. |
frnd | frnd(v1,v2[,m[,n]]) | landed | An 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. |
unifpdf | unifpdf(x[,a,b]) | landed | The 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. |
unifcdf | unifcdf(x[,a,b]) | landed | The uniform cumulative probability at x on [a,b]; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
unifinv | unifinv(p[,a,b]) | landed | The uniform quantile on [a,b]: the x whose cumulative probability is p. |
unifrnd | unifrnd(a,b[,m[,n]]) | landed | An 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. |
unifstat | unifstat(a,b) | landed | [m, v] = the mean and VARIANCE of the uniform distribution on [a,b]. |
unifit | unifit(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. |
exppdf | exppdf(x[,mu]) | landed | The exponential density at x with MEAN mu. mu is the MEAN, not a rate: exppdf(x,2) is exp(-x/2)/2. |
expcdf | expcdf(x[,mu]) | landed | The exponential cumulative probability at x with MEAN mu; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
expinv | expinv(p[,mu]) | landed | The exponential quantile with MEAN mu: the x whose cumulative probability is p. |
exprnd | exprnd(mu[,m[,n]]) | landed | An 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. |
expstat | expstat(mu) | landed | [m, v] = the mean and VARIANCE of the exponential distribution with MEAN mu. |
expfit | expfit(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. |
poisspdf | poisspdf(x,lambda) | landed | The 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. |
poisscdf | poisscdf(x,lambda) | landed | The Poisson cumulative probability at x with mean lambda; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
poissinv | poissinv(p,lambda) | landed | The Poisson quantile with mean lambda: smallest count whose cumulative probability reaches p. |
poissrnd | poissrnd(lambda[,m[,n]]) | landed | An 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. |
poisstat | poisstat(lambda) | landed | [m, v] = the mean and VARIANCE of the Poisson distribution with mean lambda. |
poissfit | poissfit(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. |
binopdf | binopdf(x,n,p) | landed | The 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. |
binocdf | binocdf(x,n,p) | landed | The binomial cumulative probability at x of n trials at probability p; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
binoinv | binoinv(p,n,p) | landed | The binomial quantile of n trials at probability p: smallest count whose cumulative probability reaches p. |
binornd | binornd(n,p[,m[,n]]) | landed | An 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. |
binostat | binostat(n,p) | landed | [m, v] = the mean and VARIANCE of the binomial distribution of n trials at probability p. |
binofit | binofit(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. |
gampdf | gampdf(x,a[,b]) | landed | The 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. |
gamcdf | gamcdf(x,a[,b]) | landed | The gamma cumulative probability at x of shape a and SCALE b; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
gaminv | gaminv(p,a[,b]) | landed | The gamma quantile of shape a and SCALE b: the x whose cumulative probability is p. |
gamrnd | gamrnd(a,b[,m[,n]]) | landed | An 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. |
gamstat | gamstat(a[,b]) | landed | [m, v] = the mean and VARIANCE of the gamma distribution of shape a and SCALE b. |
gamfit | gamfit(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. |
betapdf | betapdf(x,a,b) | landed | The 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. |
betacdf | betacdf(x,a,b) | landed | The beta cumulative probability at x of shapes a and b; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
betainv | betainv(p,a,b) | landed | The beta quantile of shapes a and b: the x whose cumulative probability is p. |
betarnd | betarnd(a,b[,m[,n]]) | landed | An 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. |
betastat | betastat(a,b) | landed | [m, v] = the mean and VARIANCE of the beta distribution of shapes a and b. |
lognpdf | lognpdf(x[,mu,sigma]) | landed | The 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. |
logncdf | logncdf(x[,mu,sigma]) | landed | The 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. |
logninv | logninv(p[,mu,sigma]) | landed | The lognormal quantile whose LOG is normal with mean mu and deviation sigma: the x whose cumulative probability is p. |
lognrnd | lognrnd(mu,sigma[,m[,n]]) | landed | An 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. |
lognstat | lognstat(mu,sigma) | landed | [m, v] = the mean and VARIANCE of the lognormal distribution whose LOG is normal with mean mu and deviation sigma. |
lognfit | lognfit(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. |
wblpdf | wblpdf(x[,A,B]) | landed | The 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. |
wblcdf | wblcdf(x[,A,B]) | landed | The Weibull cumulative probability at x of SCALE A and SHAPE B; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
wblinv | wblinv(p[,A,B]) | landed | The Weibull quantile of SCALE A and SHAPE B: the x whose cumulative probability is p. |
wblrnd | wblrnd(A,B[,m[,n]]) | landed | An 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. |
wblstat | wblstat(A,B) | landed | [m, v] = the mean and VARIANCE of the Weibull distribution of SCALE A and SHAPE B. |
wblfit | wblfit(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. |
raylpdf | raylpdf(x[,b]) | landed | The Rayleigh density at x of scale b. |
raylcdf | raylcdf(x[,b]) | landed | The Rayleigh cumulative probability at x of scale b; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
raylinv | raylinv(p[,b]) | landed | The Rayleigh quantile of scale b: the x whose cumulative probability is p. |
raylrnd | raylrnd(b[,m[,n]]) | landed | An 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. |
raylstat | raylstat(b) | landed | [m, v] = the mean and VARIANCE of the Rayleigh distribution of scale b. |
raylfit | raylfit(x[,alpha]) | landed | [bhat, bci] = the Rayleigh fit: sqrt(mean(x.^2)/2), with a chi-square interval on 2n degrees of freedom. |
evpdf | evpdf(x[,mu,sigma]) | landed | The 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. |
evcdf | evcdf(x[,mu,sigma]) | landed | The extreme-value cumulative probability at x of location mu and scale sigma; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
evinv | evinv(p[,mu,sigma]) | landed | The extreme-value quantile of location mu and scale sigma: the x whose cumulative probability is p. |
evrnd | evrnd(mu,sigma[,m[,n]]) | landed | An 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. |
evstat | evstat(mu,sigma) | landed | [m, v] = the mean and VARIANCE of the extreme-value distribution of location mu and scale sigma. |
evfit | evfit(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. |
gevpdf | gevpdf(x[,k,sigma,mu]) | landed | The 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. |
gevcdf | gevcdf(x[,k,sigma,mu]) | landed | The 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. |
gevinv | gevinv(p[,k,sigma,mu]) | landed | The generalized extreme-value quantile of SHAPE k, scale sigma and location mu: the x whose cumulative probability is p. |
gevrnd | gevrnd(k,sigma,mu[,m[,n]]) | landed | An 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. |
gevstat | gevstat(k,sigma,mu) | landed | [m, v] = the mean and VARIANCE of the generalized extreme-value distribution of SHAPE k, scale sigma and location mu. |
gppdf | gppdf(x[,k,sigma,theta]) | landed | The 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. |
gpcdf | gpcdf(x[,k,sigma,theta]) | landed | The 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. |
gpinv | gpinv(p[,k,sigma,theta]) | landed | The generalized Pareto quantile of SHAPE k, scale sigma and threshold theta: the x whose cumulative probability is p. |
gprnd | gprnd(k,sigma,theta[,m[,n]]) | landed | An 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. |
gpstat | gpstat(k,sigma[,theta]) | landed | [m, v] = the mean and VARIANCE of the generalized Pareto distribution of SHAPE k, scale sigma and threshold theta. |
nbinpdf | nbinpdf(x,r,p) | landed | The 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. |
nbincdf | nbincdf(x,r,p) | landed | The negative binomial cumulative probability at x of r successes at probability p; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
nbininv | nbininv(p,r,p) | landed | The negative binomial quantile of r successes at probability p: smallest count whose cumulative probability reaches p. |
nbinrnd | nbinrnd(r,p[,m[,n]]) | landed | An 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. |
nbinstat | nbinstat(r,p) | landed | [m, v] = the mean and VARIANCE of the negative binomial distribution of r successes at probability p. |
geopdf | geopdf(x,p) | landed | The geometric density at x at probability p. It counts FAILURES before the first success, so the support starts at 0. |
geocdf | geocdf(x,p) | landed | The geometric cumulative probability at x at probability p; a trailing "upper" answers the upper tail exactly rather than 1 - p. |
geoinv | geoinv(p,p) | landed | The geometric quantile at probability p: smallest count whose cumulative probability reaches p. |
geornd | geornd(p[,m[,n]]) | landed | An 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. |
geostat | geostat(p) | landed | [m, v] = the mean and VARIANCE of the geometric distribution at probability p. |
hygepdf | hygepdf(x,M,K,N) | landed | The hypergeometric density at x drawing N from a population of M holding K successes. |
hygecdf | hygecdf(x,M,K,N) | landed | The 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. |
hygeinv | hygeinv(p,M,K,N) | landed | The hypergeometric quantile drawing N from a population of M holding K successes: smallest count whose cumulative probability reaches p. |
hygernd | hygernd(M,K,N[,m[,n]]) | landed | An 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. |
hygestat | hygestat(M,K,N) | landed | [m, v] = the mean and VARIANCE of the hypergeometric distribution drawing N from a population of M holding K successes. |
pdf | pdf(name, x[, a, b, c]) | landed | The 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 |
random | random(name, p1, ..., pk[, m[, n]]) | landed | A 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 |
nlinfit | nlinfit(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 |
nlparci | nlparci(beta,resid,"covar"|"jacobian",M[,"alpha",a]) | landed | ci = 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 |
ridge | ridge(y,X,k[,scaled]) | landed | b = 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]) | landed | SIMPLS 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 |
cophenet | cophenet(Z,Y) | landed | The 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 |
inconsistent | inconsistent(Z[,depth]) | landed | The (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 |
kmeans | kmeans(X,k,"Start",C[,"Distance",d][,"MaxIter",n]) | landed | Lloyd'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 |
kmedoids | kmedoids(X,k,"Start",C[,"Distance",d]) | landed | The 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 |
silhouette | silhouette(X,idx[,metric]) | landed | One 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 |
anova1 | anova1(y[,group]) | landed | One-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 |
anova2 | anova2(y[,reps]) | landed | Two-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 |
kruskalwallis | kruskalwallis(y[,group]) | landed | anova1 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 |
friedman | friedman(y[,reps]) | landed | The 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 |
multcompare | multcompare(stats) | landed | Refused: 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 |
kstest | kstest(x[,"Alpha",a][,"Tail",t]) | landed | One-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 |
kstest2 | kstest2(x1,x2[,"Alpha",a][,"Tail",t]) | landed | Two-sample Kolmogorov-Smirnov: [h,p,ks2stat] = kstest2(...). The p-value is the asymptotic Kolmogorov series on lambda with Stephens' small-sample correction |
lillietest | lillietest(x[,"Distribution",d][,"Alpha",a]) | landed | Kolmogorov-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" |
adtest | adtest(x[,"Distribution",d][,"Alpha",a]) | landed | Anderson-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 |
jbtest | jbtest(x[,alpha]) | landed | Jarque-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 |
mvnpdf | mvnpdf(X[,Mu[,Sigma]]) | landed | The 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 |
mvncdf | mvncdf(X[,mu,Sigma]) | mvncdf(XL,XU,mu,Sigma) | landed | The 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 |
mvtpdf | mvtpdf(X,C,df) | landed | The 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 |
mvnrnd | mvnrnd(mu,Sigma[,n]) | landed | n rows drawn from the multivariate normal. A DRAW: its numbers cannot be compared with MATLAB's, whose generator is a different stream |
mvtrnd | mvtrnd(C,df[,n]) | landed | n rows drawn from the multivariate t. A draw; see mvnrnd |
wishrnd | wishrnd(Sigma,df) | landed | One draw from the Wishart distribution, through Bartlett's decomposition. A draw; see mvnrnd |
iwishrnd | iwishrnd(Tau,df) | landed | One draw from the inverse Wishart distribution. A draw; see mvnrnd |
classify | classify(sample,training,group[,type[,prior]]) | landed | Discriminant 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 |
confusionmat | confusionmat(g,ghat[,"Order",order]) | landed | The 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 |
perfcurve | perfcurve(labels,scores,posclass[,"XCrit",x][,"YCrit",y]) | landed | A 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 |
randsample | randsample(n,k[,replace[,w]]) | landed | k values drawn from 1..n, or from a population vector. WITHOUT replacement by default -- the opposite of datasample, which is MATLAB's own inconsistency |
ttest | ttest(x[, m]) / ttest(x, y) / [h, p, ci] = ttest(...) | landed | One-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 |
ztest | ztest(x, m, sigma) / [h, p, ci] = ztest(...) | landed | The 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.
| Function | Signature | Row | Meaning |
|---|---|---|---|
divisors | divisors(n) | landed | Every 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] |
str2sym | str2sym("expr") | landed | Read 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) |
symvar | symvar(f[,1]) | landed | The 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 |
expand | expand(f[,"ArithmeticOnly",true]) | landed | Distribute 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 |
simplify | simplify(f) | landed | Rational 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) |
collect | collect(f[,x]) | landed | Gather like powers of x, coefficients kept symbolic: collect(a*x + b*x + c, x) is x*(a + b) + c |
combine | combine(f,target) | landed | The 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) | landed | The expression over a common denominator, split, with the common factor cancelled: numden(1/x + 1/y) is (x + y) over x*y |
adjoint | adjoint(A) | landed | The adjugate: the transposed cofactor matrix, so adjoint(A)/det(A) is inv(A). Symbolic matrices only (T4.13) |
charpoly | charpoly(A[,x]) | landed | The characteristic polynomial: a coefficient ROW without a variable, the polynomial in x with one. Symbolic matrices only (T4.13) |
limit | limit(f[,x],a[,"left"|"right"]) | landed | The 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) |
symsum | symsum(f[,k][,a,b]) | landed | The 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) |
symprod | symprod(f[,k][,a,b]) | landed | The product of f over k: numeric bounds, a body free of the index (a^n), or the index itself (factorial(n)) (T4.7) |
vpasolve | vpasolve(eqn[,x]) | landed | solve's answer as digits. A complex root is refused: this console's vpa has real decimal arithmetic and no complex form (T4.8) |
heaviside | heaviside(x) | landed | The 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) |
kroneckerDelta | kroneckerDelta(m[,n]) | landed | 1 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) |
piecewise | piecewise(cond,val[,cond,val][,otherwise]) | landed | A 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) |
assume | assume(x,"real") / assume(x>0) | landed | Constrain 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) |
assumeAlso | assumeAlso(x>2) | landed | The same, ADDING to what is already assumed rather than replacing it (T4.15) |
assumptions | assumptions[(x)] | landed | What 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) |
isAlways | isAlways(cond) | landed | Is 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) |
simplifyFraction | simplifyFraction(f[,"Expand",tf]) | landed | The 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 |
partfrac | partfrac(f[,x]) | landed | The 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"]) | landed | The 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 |
rewrite | rewrite(f,target) | landed | Rewrite to "exp" (Euler's formulas -- this console's tree carries the imaginary unit), "sincos" or "sqrt" |
horner | horner(p[,x]) | landed | The nested form: horner(x^2 + 3*x + 1) is x*(x + 3) + 1 |
pretty | pretty(f) | landed | The 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 |
subs | subs(f,old,new) | landed | Substitute. ⚠ 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 |
vpa | vpa(f[,d]) | landed | Variable 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 |
digits | digits[(d)] | landed | Read or set the precision vpa uses when it is not told. 32 by default, as in MATLAB |
int | int(f[,x][,a,b]) | landed | The 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 |
finverse | finverse(f[,x]) | landed | The 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) |
compose | compose(f,g[,x[,y]]) | landed | f 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) |
dsolve | dsolve(eqn[,cond,...]) | landed | Solve 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) |
laplace | laplace(f[,var][,transVar]) | landed | The 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) |
ilaplace | ilaplace(F[,var][,transVar]) | landed | The 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) |
ztrans | ztrans(f[,var][,transVar]) | landed | The 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) |
iztrans | iztrans(F[,var][,transVar]) | landed | The 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) |
fourier | fourier(f[,var][,transVar]) | landed | The 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) |
ifourier | ifourier(F[,var][,transVar]) | landed | The 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) |
jacobian | jacobian(f[,v]) | landed | One row per function, one column per variable; symvar's order when the variables are not given |
hessian | hessian(f[,v]) | landed | The matrix of second derivatives of a scalar expression |
laplacian | laplacian(f[,v]) | landed | The sum of the second derivatives -- the SYMBOLIC Laplacian. The discrete one over numbers is del2 |
poly2sym | poly2sym(c[,x]) | landed | A coefficient row (highest power first) as a symbolic polynomial; the console's own polynomial value is accepted too |
sym2poly | sym2poly(p) | landed | The coefficients of a symbolic polynomial in ONE variable, highest power first, as plain numbers |
matlabFunction | matlabFunction(f[,"Vars",[x y]]) | landed | The 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 |
latex | latex(f) | landed | The expression in LaTeX, in MATLAB's own spelling: \\frac{1}{x}, \\sqrt{x}, \\mathrm{atan}\\left(x\\right) |
symgrad | symgrad("expr",x0) | extra | Central-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.
| Function | Signature | Row | Meaning |
|---|---|---|---|
optimget | optimget(opts,"Name"[,default]) | landed | One 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 |
fminunc | fminunc(f,x0) / [x,fval] = fminunc(f,x0) / [x,fval,exitflag] = fminunc(f,x0) | landed | The 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 |
fminimax | fminimax(F,x0[,A,b,Aeq,beq,lb,ub]) | landed | The 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 |
fgoalattain | fgoalattain(F,x0,goal,weight[,A,b,Aeq,beq,lb,ub]) | landed | The 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 |
fsolve | fsolve(F,x0) / [x,fval] = fsolve(F,x0) / [x,fval,exitflag] = fsolve(F,x0) | landed | A 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 |
lsqnonlin | lsqnonlin(F,x0) / [x,resnorm,residual,exitflag] = lsqnonlin(F,x0) | landed | The 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 |
lsqcurvefit | lsqcurvefit(F,x0,xdata,ydata) / [x,resnorm,residual,exitflag] = lsqcurvefit(...) | landed | The x that fits F(x,xdata) to ydata in least squares -- lsqnonlin on F(x,xdata) - ydata, which is all MATLAB's lsqcurvefit is |
checkGradients | checkGradients(f,x0[,"Tolerance",t]) | landed | true 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]) | landed | The 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 |
linprog | linprog(f[, A, b, Aeq, beq, lb, ub]) / [x, fval, exitflag] = linprog(...) | landed | min 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 |
quadprog | quadprog(H, f[, A, b, Aeq, beq, lb, ub]) / [x, fval, exitflag] = quadprog(...) | landed | min 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 |
lsqlin | lsqlin(C, d[, A, b, Aeq, beq, lb, ub]) / [x, resnorm, residual, exitflag] = lsqlin(...) | landed | min \|\|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 |
intlinprog | intlinprog(f, intcon, A, b[, Aeq, beq, lb, ub]) / [x, fval, exitflag] = intlinprog(...) | landed | min 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.
| Function | Signature | Row | Meaning |
|---|---|---|---|
tffit | tffit(u,y,numOrder,denOrder,Ts[,"method"]) | extra | Fit 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 |
armax | armax(u,y,Ts,[na nb nc nk]) | landed | MATLAB'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 |
oe | oe(u,y,Ts,[nb nf nk]) | landed | MATLAB'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 |
bj | bj(u,y,Ts,[nb nc nd nf nk]) | landed | MATLAB'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 |
pem | pem(u,y,Ts,sys) | landed | MATLAB'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 |
ssest | ssest(u,y,Ts,nx) | landed | MATLAB'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 |
ssregest | ssregest(u,y,Ts,nx) | landed | MATLAB'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]) |
arx | arx(u,y,Ts,[na nb nk]) | landed | MATLAB'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 |
ar | ar(y,n[,approach[,window]]) | landed | MATLAB'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 |
ivar | ivar(y,na[,nc]) | landed | MATLAB'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) |
rpem | rpem(z,[na nb nc nd nf nk],adm,adg) | landed | MATLAB'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 |
covf | covf(z,M) | landed | MATLAB'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 |
etfe | etfe(u,y,Ts[,M[,N]]) | landed | MATLAB'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 |
spa | spa(u,y,Ts[,M[,w]]) | landed | MATLAB'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) |
rarx | rarx(z,[na nb nk],adm,adg) | landed | MATLAB'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 |
arxstruc | arxstruc(ue,ye,uv,yv,Ts,NN) | landed | MATLAB'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 |
selstruc | selstruc(V,c) | landed | MATLAB'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 |
delayest | delayest(u,y,Ts[,na,nb,nkmin,nkmax]) | landed | MATLAB'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 |
goodnessOfFit | goodnessOfFit(x,xref,measure) | landed | MATLAB'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 |
compare | compare(u,y,Ts,sys) | landed | MATLAB'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 |
tffitPercent | tffitPercent(u,y,numOrder,denOrder,Ts[,"method"]) | extra | NRMSE fit percentage of that same estimate (100 = exact). Spelled tfestfit until T6.2, and it moved with tffit |
simtf | simtf(tf,u) | extra | Simulate discrete transfer function tf's response to input u |
polydata | polydata(sys) | landed | MATLAB'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 |
idssdata | idssdata(sys) | landed | MATLAB'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 |
getpvec | getpvec(sys[,"free"]) | landed | MATLAB'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 |
setpvec | setpvec(sys,p) | landed | MATLAB'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 |
getcov | getcov(sys) | landed | MATLAB'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 |
idtf | idtf(num,den[,Ts]) | landed | MATLAB'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 |
idpoly | idpoly(A,B[,C,D,F],"Ts",Ts) | landed | MATLAB'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 |
idss | idss(A,B,C,D,K,x0,Ts) | landed | MATLAB'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 |
sim | sim(sys,u) | landed | The 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 |
predict | predict(sys,u,y,Ts,k) | landed | The 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 |
forecast | forecast(sys,u,y,Ts,K[,uf]) | landed | K 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 |
resid | resid(u,y,Ts,sys) | landed | The 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.
| Function | Signature | Row | Meaning |
|---|---|---|---|
quatfromaxisangle | quatfromaxisangle(axis,angle) | landed | Quaternion from a rotation axis and angle (radians) |
quatfromeuler | quatfromeuler(yaw,pitch,roll) | landed | Quaternion from ZYX Euler angles (radians) |
quat2euler | quat2euler(q) | landed | Quaternion to ZYX Euler angles (radians) |
quatmul | quatmul(q1,q2) | extra | Hamilton product q1*q2 (compose rotations) |
quatconj | quatconj(q) | landed | Quaternion 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 |
quatinv | quatinv(q) | landed | Quaternion 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 |
quatnormalize | quatnormalize(q) | landed | Unit-normalize a quaternion: q over quatmod, the modulus itself (NOT quatnorm). Same two shapes as quatconj |
quatslerp | quatslerp(q1,q2,t) | extra | Spherical linear interpolation, t in [0,1] |
rotatevector | rotatevector(q,v) | extra | Rotate 3x1 vector v by quaternion q |
quatmultiply | quatmultiply(q[,r]) | landed | Hamilton 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 |
quatdivide | quatdivide(q,r) | landed | q * inv(r) over N x 4 rows, broadcasting like quatmultiply |
quatnorm | quatnorm(q) | landed | The 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 |
quatmod | quatmod(q) | landed | The modulus sqrt(w^2+x^2+y^2+z^2), as an N x 1. quatnormalize divides by this one |
quatrotate | quatrotate(q,v) | landed | Rotate 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) |
convvel | convvel(x,"from","to") | landed | Convert a velocity. Units: "ft/s", "m/s", "km/s", "in/s", "km/h", "mph", "kts", "ft/min". |
convlength | convlength(x,"from","to") | landed | Convert a length. Units: "ft", "m", "km", "in", "mi", "naut mi" (with the space). |
convang | convang(x,"from","to") | landed | Convert a angle. Units: "deg", "rad", "rev". |
convangvel | convangvel(x,"from","to") | landed | Convert a angular velocity. Units: "deg/s", "rad/s", "rpm". |
convangacc | convangacc(x,"from","to") | landed | Convert a angular acceleration. Units: "deg/s^2", "rad/s^2", "rpm/s". |
convmass | convmass(x,"from","to") | landed | Convert a mass. Units: "lbm", "kg", "slug". |
convforce | convforce(x,"from","to") | landed | Convert a force. Units: "lbf", "N". |
convpres | convpres(x,"from","to") | landed | Convert a pressure. Units: "psi", "Pa", "psf", "atm". |
convtemp | convtemp(x,"from","to") | landed | Convert a temperature. Units: "K", "F", "C", "R". convtemp is the only AFFINE one: it carries an offset as well as a factor. |
convdensity | convdensity(x,"from","to") | landed | Convert a density. Units: "lbm/ft^3", "kg/m^3", "slug/ft^3", "lbm/in^3". |
convacc | convacc(x,"from","to") | landed | Convert a acceleration. Units: "ft/s^2", "m/s^2", "km/s^2", "in/s^2", "km/h-s", "mph/s", "G's". |
dcmbody2wind | dcmbody2wind(alpha,beta) | landed | Body-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 |
dcmbody2stability | dcmbody2stability(alpha) | landed | Body-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 |
dcmecef2ned | dcmecef2ned(lat,lon) | landed | ECEF-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) |
dcm2alphabeta | dcm2alphabeta(dcm[,action[,tol]]) | landed | The 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 |
dcm2latlon | dcm2latlon(dcm[,action[,tol]]) | landed | The 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 |
quat2dcm | quat2dcm(q) | landed | The 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 |
dcm2quat | dcm2quat(dcm[,action[,tol]]) | landed | The 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)) |
angle2quat | angle2quat(r1,r2,r3[,order]) | landed | The 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 |
quat2angle | quat2angle(q[,order]) | landed | The 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 |
angle2dcm | angle2dcm(r1,r2,r3[,order]) | landed | The 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 |
dcm2angle | dcm2angle(dcm[,order[,limit]]) | landed | The 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 |
rod2quat | rod2quat(rod) | landed | The 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 |
quat2rod | quat2rod(q) | landed | The 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 |
rod2dcm | rod2dcm(rod) | landed | The direction cosine matrix of one Rodrigues vector. A zero vector is the identity rotation and answers the identity matrix |
dcm2rod | dcm2rod(dcm[,action[,tol]]) | landed | The 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 |
rod2angle | rod2angle(rod[,order]) | landed | The 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 |
angle2rod | angle2rod(r1,r2,r3[,order]) | landed | The 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 |
quatlog | quatlog(q) | landed | The 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) |
quatexp | quatexp(q) | landed | The 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 |
quatpower | quatpower(q,t) | landed | The 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 |
quatinterp | quatinterp(p,q,f[,method]) | landed | Interpolate 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 |
atmosisa | atmosisa(h[,action]) | landed | International 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 |
atmoscoesa | atmoscoesa(h[,action]) | landed | 1976 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 |
atmospalt | atmospalt(P[,action]) | landed | Pressure altitude: the COESA altitude whose ambient pressure is P pascals. The inverse of atmoscoesa's pressure, not of atmosisa's |
atmoslapse | atmoslapse(h,g,gamma,R,L,hts,htp,rho0,P0,T0[,H0]) | landed | The 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 |
geoc2geod | geoc2geod(gc,r[,f,Re]) | landed | Geocentric latitude and radius to [geodetic latitude, height]. Degrees in, degrees and metres out. A latitude past the pole folds back before anything else happens |
geod2geoc | geod2geoc(gd,h[,f,Re]) | landed | Geodetic latitude and height to [geocentric latitude, radius] |
lla2ecef | lla2ecef(lla[,f,Re]) | landed | N 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 |
ecef2lla | ecef2lla(p[,f,Re]) | landed | N 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 |
lla2flat | lla2flat(lla,ll0,psi0,href[,f,Re]) | landed | N 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 |
flat2lla | flat2lla(p,ll0,psi0,href[,f,Re]) | landed | The inverse of lla2flat |
geocradius | geocradius(lambda[,model]) | landed | The 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 |
gravitywgs84 | gravitywgs84(h,lat[,lon,method[,options]]) | landed | WGS84 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 |
gravitycentrifugal | gravitycentrifugal(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 |
gravityzonal | gravityzonal(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 |
airspeed | airspeed(vel) | landed | The norm of each ROW of an N x 3 body-axis velocity. A three-element row is ONE velocity, not three speeds |
machnumber | machnumber(vel,a) | landed | airspeed(vel) over the local speed of sound; a is a scalar or one entry per row |
dpressure | dpressure(vel,rho) | landed | Dynamic pressure, 0.5*rho*\|vel\|^2, over the norm of each row |
alphabeta | alphabeta(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 |
correctairspeed | correctairspeed(v,a,P0,from,to[,"Equation"]) | landed | Convert 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 |
juliandate | juliandate(y,mo,d[,h,mi,s]) | landed | The 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 |
mjuliandate | mjuliandate(y,mo,d[,h,mi,s]) | landed | The modified Julian date -- juliandate less 2400000.5, which puts the day boundary at midnight instead of noon |
decyear | decyear(y,mo,d[,h,mi,s]) | landed | The 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 |
leapyear | leapyear(y) | landed | A 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 |
siderealTime | siderealTime(utcJD[,dUT1,dAT]) | landed | Greenwich 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.
| Function | Signature | Row | Meaning |
|---|---|---|---|
fittype | fittype(expr[,"independent",x][,"coefficients",a,b,...]) | landed | ft = 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 |
coeffvalues | coeffvalues(f) | landed | The fitted coefficients as a ROW, in the model's coefficient order (T8.8) |
coeffnames | coeffnames(f) | landed | The 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) |
formula | formula(f) | landed | The model's formula as MATLAB writes it -- "p1*x + p2" (T8.8) |
numcoeffs | numcoeffs(f) | landed | How many coefficients the model has (T8.8) |
category | category(f) | landed | "library", "custom", "interpolant" or "spline" (T8.8) |
type | type(f) | landed | The 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 |
indepnames | indepnames(f) | landed | The 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) |
dependnames | dependnames(f) | landed | The dependent variable's name, "y" unless the fittype said otherwise (T8.8) |
argnames | argnames(f) | landed | Every coefficient name and then the independent variable, in one string (T8.8) |
confint | confint(f[,level]) | landed | The 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 |
predint | predint(f,x[,level[,"observation"|"functional"[,"on"|"off"]]]) | landed | The 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 |
differentiate | differentiate(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) |
csaps | csaps(x,y[,p[,xx]]) | landed | The 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") |
csapi | csapi(x,y[,xx]) | landed | The 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. |
csape | csape(x,y[,conds[,valconds]]) | landed | The 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. |
spap2 | spap2(knots,k,x,y[,w]) | landed | The 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. |
fnval | fnval(f,x[,side]) | landed | Evaluate 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. |
fnder | fnder(f[,n]) | landed | Differentiate 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. |
fnint | fnint(f[,value]) | landed | The 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. |
ppmak | ppmak(breaks,coefs[,d]) | landed | Build 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. |
spmak | spmak(knots,coefs[,sizec]) | landed | Build 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. |
fn2fm | fn2fm(f[,form[,sconds]]) | landed | Convert 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. |
fnplt | fnplt(f) | landed | Refused (T8.15): fnplt DRAWS a form, and this console draws through its own plot verbs -- plot(xx, fnval(f, xx)) is the same picture. |
integrate | integrate(f,x,x0) | landed | The 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]) | landed | Column-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]) | landed | The 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 |
excludedata | excludedata(x,y,method,opt) | landed | A 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 |