How to make normalised frequency distribution plot?

3 views (last 30 days)
Pritha Pande
Pritha Pande on 24 May 2018
Answered: Rishabh Rathore on 30 May 2018
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.

Answers (1)

Rishabh Rathore
Rishabh Rathore on 30 May 2018
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).

Tags

Community Treasure Hunt

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

Start Hunting!