Plot of maximum value of chosen column in matrix
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
/matlabcentral/profile/authors/13737395
am 23 Okt. 2018
Erneut geöffnet: madhan ravi
am 15 Nov. 2018
clear close all clc
t = linspace(0,10,15); t = t'; rng default M = rand(15,5);
plot(t, M(:,1)); max_M = max(M); %maximum of each column max = max(max(M)); %total max
I would like to plot maximum value of first column of matrix M(:,1); and indicate this information on a plot.
Something like this:
0 Kommentare
Antworten (2)
madhan ravi
am 23 Okt. 2018
Bearbeitet: madhan ravi
am 23 Okt. 2018
t = linspace(0,10,15);
t = t';
rng default
M = rand(15,5);
plot(t, M(:,1));
hold on
m = M(:,1)
[P,K]=findpeaks(m)
plot(t(K(1)),P(1),'x')
hold off
4 Kommentare
jonas
am 23 Okt. 2018
Bearbeitet: jonas
am 23 Okt. 2018
In this case you could simply find the max in each column in one go
[vm,idx] = max(M); %maximum of each column
plot(t,M);
scatter(t(idx),vm,'rx');
would you prefer to plot only the max of the first column, then
scatter(t(idx(1)),vm(1),'rx')
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects 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!
