how to plot a graph in matlab ?

1 回表示 (過去 30 日間)
aditya sahu
aditya sahu 2017 年 10 月 3 日
コメント済み: Walter Roberson 2017 年 10 月 4 日
Let given array A with 512*512 elements are (here one sample of 4*4 is given)
5 4 6 8
9 11 30 34
12 13 13 14
how to plot a graph where x-axis contains the values of individual elements of 512*256 matrix and y-axis contain the frequency of the difference value. The frequency of difference value can be obtained as
1 -2
-2 -4
-1 -1
here the difference value can be found by subtracting the 2 consecutive elements in a row.Now suppose the original matrix A is 512*512 elements, then the difference matrix will be 512 * 256 elements.
Kindly suggest
  5 件のコメント
aditya sahu
aditya sahu 2017 年 10 月 3 日
ok..by doing A(:, 1:2:end) - A(:,2:2:end) gives 512 x 256 array. Then how can i plot a graph with x-axis as its elements of 512*256 array and y-axis as its frequency of occurence.
aditya sahu
aditya sahu 2017 年 10 月 3 日
@ KSSV SIR, I HAVE ATTACHED A SAMPLE FILE THE PLOT SHOULD COME OR LOOKS LOOKS LIKE THIS.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2017 年 10 月 3 日
B = A(:, 1:2:end) - A(:,2:2:end);
histogram(B, 'binmethods', 'integers')
Note: this might require a fairly recent MATLAB (I do not recall ever having seen that option before.)
  9 件のコメント
aditya sahu
aditya sahu 2017 年 10 月 4 日
Thank you dear @ Walter Roberson.. Actually not required,but i have taken two different matrices where one is in uint8 and other is double. thats i have brrought back both to unit32..Thats all only.
Walter Roberson
Walter Roberson 2017 年 10 月 4 日
It is not a problem to use double() on an array that is already double(), so leave out the conversion to int32()

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by