Function with input argument an integer n greater than 1 and output argument a column vector n
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello dear friends, I hope you can help me with this:
I must find a function called ent_col with input argument an integer n > 1 and output argument a column vector v of length n ordered such that no element of the vector is equal to its own index ( v(k) ≠ k ), I did this:
function v = ent_col(n)
arguments
n (1:end)
end
v = mean(n;"all");
end
Than k you for helping me dear friends!
0 Kommentare
Akzeptierte Antwort
Voss
am 7 Dez. 2022
How about this?
function v = ent_col(n)
v = (0:n-1).'; % v(k) == k-1 ~= k
end
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!