How can i draw this in a plot
显示 更早的评论
I am trying to draw this plot which have x axis value increase and then decrease as below

but when i do that in matlab it return the values as below

x = [ 355 390 401 410 430 420 415 415 400]
y = [ 190 210 220 225 225 221 220 220 205]
Please need your help in make this plot
回答(1 个)
Jan
2018-2-4
Maybe:
x = [ 355 390 401 410 430 420 415 415 400]
y = [ 190 210 220 225 225 221 220 220 205]
plot(x)
hold on
plot(y)
4 个评论
Tareq Al-Ma'aiteh
2018-2-4
编辑:Tareq Al-Ma'aiteh
2018-2-4
Jan
2018-2-4
@Tareq: You have provided two data sets. Then my first guess is that both are relevant. You have posted a diagram with 3 lines, therefore I assumed, that your questions concerns multiple lines in one diagram. I have provided a code to draw the two lines in one diagram.
Now you explain, that you want one line also. It is trivial not to run the three commands I had posted, but the wanted one only:
plot(y)
Do you want to set the Y-limits also?
ylim([170, 230])
Or does the title matter also?
title('Y')
Please explain more clearly, what you want.
Tareq Al-Ma'aiteh
2018-2-4
Jan
2018-2-4
x = [ 355 390 401 410 430 420 415 415 400]
y = [ 190 210 220 225 225 221 220 220 205]
plot(y)
set(gca, 'XTick', 1:length(x), 'XTickLabel', sprintfc('%g', x))
If this solves your problem, the question was: "How to set the XTickLabels to values specified by the user?"
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
