ones
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.
| Code | Input | Output | Description |
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
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")
from plotting