Issue Plotting x and y coordinates

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.

Antworten (1)

Rik
Rik am 2 Feb. 2018

0 Stimmen

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 Kommentare

Tellrell White
Tellrell White am 2 Feb. 2018
I understand, however, I don't think I'm going about this correctly. What I'm attempting to do is plot 10 points. I want both the y and x axes to go from 0 to 1 in 0.1 intervals and I want to plot 10 points corresponding to the points in probability of detection and probability of false alarm with one point from each forming one point on the plot. For instance, the pair (1.0, 1.0)would be 1 point on the plot.
Walter Roberson
Walter Roberson am 2 Feb. 2018
plot(Prob_FalseAlarm, Prob_det,'*r')
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')

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 2 Feb. 2018

Kommentiert:

am 2 Feb. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by