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.

답변 (1개)

Rik
Rik 2018년 2월 2일

0 개 추천

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

Tellrell White
Tellrell White 2018년 2월 2일
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 2018년 2월 2일
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')

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2018년 2월 2일

댓글:

2018년 2월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by