Please help me understand what happens to the matrices bellow
Ältere Kommentare anzeigen
Hi All
I have a matrix t [3 1000]
and then these lines :
y00 = repmat( mean(t,2), 1, size(t,2))
MSE00 = mse( t - y00 )
MSE00 = mean(var(t',1))
nperf = mse(t-y)/MSE00
what does each line do ??
4 Kommentare
dpb
am 15 Mär. 2015
I suggest making up a small sample array (say 3x5) and try each step at the command line and observe, using the documentation to aid your exploration...you'll learn a lot more and retain what you learn much better that way.
farzad
am 15 Mär. 2015
Roger Stafford
am 15 Mär. 2015
The line "repmat( mean(t,2), 1, size(t,2))" first takes the mean value of each of the three rows of matrix 't', giving a 3-by-1 column vector as a result. Then the 'repmat' operator repeats this vector along the second dimension so that it is again of size 3-by-1000. Each of its thousand columns will then be the same.
dpb
am 15 Mär. 2015
NB: that bsxfun will allow writing the following lines w/o the explicit expansion, too...highly recommended as long as the version in use incorporates it (which is getting to be quite some time ago now altho I don't recall just when that was).
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Variables finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!