How can i draw this in a plot
Mostrar comentarios más antiguos
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
Respuestas (1)
Jan
el 4 de Feb. de 2018
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 comentarios
Tareq Al-Ma'aiteh
el 4 de Feb. de 2018
Editada: Tareq Al-Ma'aiteh
el 4 de Feb. de 2018
Jan
el 4 de Feb. de 2018
@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
el 4 de Feb. de 2018
Jan
el 4 de Feb. de 2018
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?"
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
