How to reverse the normalization function normc/normr?
15 views (last 30 days)
Show older comments
I have used the function of "normr/normr" to normalize a matrix, but how can I reverse the normalization? Thank you very much!
2 Comments
Image Analyst
on 16 Sep 2015
What happened to the original matrix? Why did you lose it?
I don't have the normr() function. Please list which toolbox it's in in the Products section below.
Accepted Answer
Matt J
on 16 Sep 2015
Edited: Matt J
on 16 Sep 2015
If you haven't discarded the original data, there is nothing to restore. The "restored" matrix is the original one that you already have. If you plan to throw that data away, the best thing would be to save the row-wise (or column-wise) norms and use them when needed to undo normalization, e.g.,
A =
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16
>> nr=sqrt(sum(A.^2,2)); %row-wise norms
>> B=bsxfun(@rdivide,A,nr) %same as B=normr(A)
B =
0.0602 0.3010 0.5417 0.7825
0.1091 0.3273 0.5455 0.7638
0.1493 0.3483 0.5473 0.7463
0.1826 0.3651 0.5477 0.7303
>> Arev=bsxfun(@times,B,nr) %reverse
Arev =
1.0000 5.0000 9.0000 13.0000
2.0000 6.0000 10.0000 14.0000
3.0000 7.0000 11.0000 15.0000
4.0000 8.0000 12.0000 16.0000
0 Comments
More Answers (0)
See Also
Categories
Find more on Hypothesis Tests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!