{
  "name": "Documented MATLAB operator examples: array, matrix and implicit-expansion results",
  "description": "Worked examples drawn from MathWorks documentation pages on array vs. matrix operations and operator precedence, compiled to compare each operator's family, the rule it follows and the documented result.",
  "page": "https://casrai.org/guides/matlab-operations",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-13T01:42:59Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Expression",
      "unit": "",
      "description": ""
    },
    {
      "name": "Operator family",
      "unit": "",
      "description": ""
    },
    {
      "name": "Rule",
      "unit": "",
      "description": ""
    },
    {
      "name": "Documented result",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Expression": "A*B with A=[1 3;2 4], B=[3 0;1 5]",
      "Operator family": "Matrix",
      "Rule": "Linear-algebra product",
      "Documented result": "[6 15;10 20]"
    },
    {
      "Expression": "A.*B with the same A and B",
      "Operator family": "Array",
      "Rule": "Element-by-element product",
      "Documented result": "[3 0;2 20]"
    },
    {
      "Expression": "[1 1 1]+[1 2 3]",
      "Operator family": "Array (addition)",
      "Rule": "Same size, match by position",
      "Documented result": "[2 3 4]"
    },
    {
      "Expression": "3.*[1 2 3;1 2 3]",
      "Operator family": "Array",
      "Rule": "Scalar expanded to array size",
      "Documented result": "[3 6 9;3 6 9]"
    },
    {
      "Expression": "x+y with x=[1 2 3], y=[10;15]",
      "Operator family": "Array (implicit expansion)",
      "Rule": "Row and column expand to 2-by-3",
      "Documented result": "[11 12 13;16 17 18]"
    },
    {
      "Expression": "A-m with A 3-by-3, m=[2 4]",
      "Operator family": "Array (subtraction)",
      "Rule": "Incompatible sizes",
      "Documented result": "Error"
    },
    {
      "Expression": "A./B.^2 with A=[3 9 5], B=[2 1 5]",
      "Operator family": "Array with precedence",
      "Rule": "Power evaluated before division",
      "Documented result": "[0.75 9.0 0.2]"
    },
    {
      "Expression": "(A./B).^2 with the same A and B",
      "Operator family": "Array with parentheses",
      "Rule": "Division evaluated first",
      "Documented result": "[2.25 81 1]"
    }
  ],
  "sources": [
    {
      "title": "MathWorks: Array vs. Matrix Operations",
      "url": "https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html",
      "accessed": "2026-11-12"
    },
    {
      "title": "MathWorks: Operator Precedence",
      "url": "https://www.mathworks.com/help/matlab/matlab_prog/operator-precedence.html",
      "accessed": "2026-11-12"
    }
  ]
}