how to plot a graph in matlab ?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
aditya sahu
am 3 Okt. 2017
Kommentiert: Walter Roberson
am 4 Okt. 2017
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 3 Okt. 2017
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 Kommentare
Walter Roberson
am 4 Okt. 2017
It is not a problem to use double() on an array that is already double(), so leave out the conversion to int32()
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!