简体   繁体   中英

Matlab plot a threshold line

I want to add a horizontal threshold line to my graph of 0.7. But I can't seem to get it to work.

Code

figure(1)
plot(Variance);
hold on;
plot([1 frames], threshold, 'red')

Variance is an array to be plotted and the frames are the number of variances that are plotted. I've tried moving the hold and plots around but it doesn't seem to work either.

I know this is an easy question, but everything I've looked at online doesn't seem to work either, with regards to adding them to the same plot() .

Thanks

您应该将第二个绘图线更改为

plot([1 frames], [threshold threshold], 'red');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM