Qu

ones

Builtin index · Core maths

result = ones(n) / ones(r, c)

Input: n · Output: result

What it is

A vector or matrix of ones, with the same one-argument-vs-two-argument shape rules as zeros above.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = ones(n) / ones(r, c)
n vector or matrixnot documented yet
result Vec or Mat
Returns a length-n Vec for ones(n), or an r×c Mat for ones(r, c).

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

idx = 0 to 100
theta = idx ./ 100 .* (2*pi)
r = ones(101)
polarplot(theta, r)   # a unit circle, drawn as an (x, y) curve

0° 30° 60° 90° 120° 150° 180° 210° 240° 270° 300° 330° 0.25 0.5 0.75 1 x x^2

from fundamentals

x = 0 to 9
y = sin(x / 2)
figure()
errorbar(x, y, 0.1 * ones(10))
figure()
fill_between(x, y - 0.2, y + 0.2)
figure()
bubble(x, y, abs(y) * 20 + 5)
figure()
donut([30, 20, 50], "a", "b", "c")
figure()
pie([30, 20, 50], "a", "b", "c")
a (30%) b (20%) c (50%)

from plotting