How to make normalised frequency distribution plot?

2 次查看(过去 30 天)
I have two 80*80 matrix. I would like to plot normalised frequency plot. So first I tried to normalise the 80* 80 grid with this code: A= per_monsoon_postmon; (A is my 80*80 matrix) A = rand (80,80); minA = repmat(min(A), [size(A, 1), 1]); normA = max(A) - min(A); normA = repmat(normA, [length(normA) 1]);
normalizedA = (A - minA)./normA;
But I don't this code has given me desired result, as Grids with NaN values also has a number in it. for eg. earlier grid 1*1 is NaN now it is 0.8340. Could you please help me how to normalise the 2d matrix and then plot frequency distribution plot.

回答(1 个)

Rishabh Rathore
Rishabh Rathore 2018-5-30
Here's what I understand from your question, you want to normalize A and after normalization the NaNs gets replaced by a number.
From your code, I can see that you are reassigning A using rand(). rand() itself does not creates any NaN, so there are no NaNs in A to begin with and your A is not per_monsoon_postmon rather it is rand(80,80) when it gets normalized.
And your operations to normalize doesn't change NaNs (I tried on Matlab).

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by