How can it be that a value shown in a plot cannot be found in the matrix whose values are used to generate the plot?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Luki
am 26 Dez. 2016
Bearbeitet: Image Analyst
am 26 Dez. 2016
Consider a plot of a frequency spectrum:
plot(f, X_dBm);
This plot has a peak at a frequency f_peak = 11 GHz. The amplitude in dBm = -6 dBm. You can click on the peak of the plot and it shows exactly these values for x and y. X_dBm is a matrix of t rows and n columns. I plot column n=30. When I search for the entry -6 the result is 0. How can that be? I am using:
find(X_dBm(:,30) = -6)
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 26 Dez. 2016
Bearbeitet: Image Analyst
am 26 Dez. 2016
Because it's not exactly -6. See the FAQ: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F
To fix:
oneColumn = X_dBm(:,30);
targetValue = -6;
tolerance = .01; % or whatever closeness you want.
rows = find(abs(oneColumn - targetValue) <= tolerance);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Pulsed Waveforms 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!