Technical discussion about Matlab and issues related to Digital Signal Processing.
|
Hi respected members,
I am new to Matlab
and I am using its 5.3
version.
My problem is to create data
randomly.
For my project, I have to create
at least 100 matrices which should have the dimensions of mxn,
where m=20,50 or 100
and n = 4m.
Also, the values in the matrices should range from a to b,
where a and b are parametric values defined by the user.
So, I have identified the rand operator for my puspose, and I am planning to use the following
formulae:
a +
(b-a)rand()
Rand() operator produces values between 0 and 1, in this way, I have
the values ranging between a and b.
But, I have no idea how to create the
matrices automatically :(.
for achieving this, do I have to
write a code in a file with the extention of m or something else?
I
am really looking forward to hearing your recommendations for my
problem.
Also, you can send me your sample codes if they also meet my partial
desire.
Thanks for your attentions
best regards!...
Kaan KUMRU (: 0 212 275 24 24 - 1944 |
|
|
|
Hi Kaan,
All you need to do
is:
x = a + (b-a) * rand(m,n); where m is the number of rows, n is the
number of columns, a and b is the interval and x is the output
matrix.
Hope this helps,
Jeff
====================
Jeff Winter
Snr Design Engineer
Aeroflex
www.aeroflex.com
|
|
El A las 12:12 del 24 de May de 2004, dijo: > Hi respected members, (snip) > So, I have identified the rand operator for my puspose, (snip) > > Kaan KUMRU identified, but pretty clearly not even read the help!! >> help rand RAND Uniformly distributed random numbers. RAND(N) is an N-by-N matrix with random entries, chosen from a uniform distribution on the interval (0.0,1.0). RAND(M,N) and RAND([M,N]) are M-by-N matrices with random entries. RAND(M,N,P,...) or RAND([M,N,P,...]) generate random arrays. RAND with no arguments is a scalar whose value changes each time it is referenced. RAND(SIZE(A)) is the same size as A. Sergio -- It's always darkest just before the lights go out. -- Alex Clark |