Issue Plotting x and y coordinates
Afficher commentaires plus anciens
I'm trying to do produce a simple plot in matlab using the the following code:
Prob_det = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
Prob_FalseAlarm = [1.0,1.0, 0.96, 0.8, 0.5, 0.22, 0.13, 0.06, 0.01, 0.0];
plot(Prob_FalseAlarm, Prob_det)
I'm hoping to see a plot that contains the 10 points from x and y, however, all I'm seeing is a straight line at 1 on the y axis.
Réponses (1)
Rik
le 2 Fév 2018
You see a line, because the standard format for plot is a blue line going straight from one point to the next. You can look in the documentation for other formatting options.
plot(Prob_FalseAlarm, Prob_det,'*-r')
%this will plot a continuous red line with each point marked by an asterisk
3 commentaires
Tellrell White
le 2 Fév 2018
Walter Roberson
le 2 Fév 2018
plot(Prob_FalseAlarm, Prob_det,'*r')
Star Strider
le 2 Fév 2018
Perhaps this:
Prob_det = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
Prob_FalseAlarm = [1.0,1.0, 0.96, 0.8, 0.5, 0.22, 0.13, 0.06, 0.01, 0.0];
xv = linspace(0, 1, numel(Prob_det));
figure
plot(xv, Prob_det, 'pg', xv, Prob_FalseAlarm,'pr')
grid
axis([0 1 0 1.1])
legend('Prob\_det', 'Prob\_FalseAlarm', 'Location','E')
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!