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
Jan el 4 de Feb. de 2018

0 votos

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
Tareq Al-Ma'aiteh el 4 de Feb. de 2018
Editada: Tareq Al-Ma'aiteh el 4 de Feb. de 2018
thank but unfortunately i want the plot like this
your code give two curves i want one cure like this pic
Jan
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
Tareq Al-Ma'aiteh el 4 de Feb. de 2018
the 3 curves figure is the main, but if i could draw the single curve then in could do it for the 3, the main problem you can see the values of x axis increase then decrease 355 390 400 410 430 (increase) 420 415 415 (decrease) the matlab see the axis 355 390 400 410 415 420 430 i want the the axis to be 355 390 400 410 430 420 415 415 matlab give 355 390 400 410 415 420 430
thanks a lot on your help
Jan
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?"

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 3 de Feb. de 2018

Comentada:

Jan
el 4 de Feb. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by