How can i draw the graph?
显示 更早的评论
Dear all i am new in matlab. Could.Could anyone help me in drawing the following graph for may data(data is large but i am showing you just 10 values for illustration purpose).Now i want to plot these values in xy plot such that our x-axis contains the values 1 to 10 and y-axis has the output which is given below .Our graph should look like the following image.Actual at y-axis i need three straight line parallel to x-axis at the point -3,0 and 3. -0.10890, -0.07835, 0.35470, -0.18300, 0.06880, 0.01870, 1.07650, 0.91125, 0.14735, 3.41050
THANKS

采纳的回答
更多回答(1 个)
vectors x and y contain your data
plot(x,y,'k.');
If you only have the ydata, just type
plot(y,'k.');
This holds the first plot, otherwise it would be replaced by the following ones
hold ;
This plots a green horizontal line at y=3, between 0 and 10
plot([0 10],[3 3],'g')
Type "doc plot" to get the documentation and more examples
---------------
Note This was my original answer to Zahid's question.
Star Strider gave a more complete answer, but Zahid mistakenly accepted mine instead of his.
At Zahid's request, I deleted my original answer to allow Zahid to accept Star Strider's. I'm posting my answer again as it was.
类别
在 帮助中心 和 File Exchange 中查找有关 2-D and 3-D Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

