Write a function called rand_test
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Siddharth Varshney
am 12 Dez. 2021
Beantwortet: Net Fre
am 12 Dez. 2021
Write a function called rand_test that takes one scalar positive
integer input argument n (you do not have to check the input argument) and
returns two output arguments: a column vector of n2 elements and an n-by-n
matrix. The two output arguments must contains the exact same set of random
numbers (use rand). Here is a sample run:
>> [m v] = rand_test(2)
m =
0.4170
0.7203
0.0001
0.3023
v =
0.4170 0.0001
0.7203 0.3023
Akzeptierte Antwort
Net Fre
am 12 Dez. 2021
function [m v] = rand_test(n)
m = rand(n^2,1)
v = reshape(m,[n,n])
end
0 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!