draw two curves in matlab

4 vues (au cours des 30 derniers jours)
Lilian Lilian
Lilian Lilian le 6 Mar 2022
Modifié(e) : HWIK le 6 Mar 2022
I want to draw two curves in matlab , using this code,
In this curve I want x=0, 25, 50,75, .... but not 0, 20, 40,60
help me plz
x=[0:25:200];
y1= [0.4 0.29 0.21 0.19 0.13 0.11 0.09 0.05 0.006];
y2= [0.45 0.27 0.231 0.202 0.12 0.13 0.11 0.062 0.0062];
plot(x,y1,x,y2)

Réponses (1)

HWIK
HWIK le 6 Mar 2022
Try this:
x=[0:25:200];
y1= [0.4 0.29 0.21 0.19 0.13 0.11 0.09 0.05 0.006];
y2= [0.45 0.27 0.231 0.202 0.12 0.13 0.11 0.062 0.0062];
plot(x,y1,x,y2)
xticks(x)
  2 commentaires
Lilian Lilian
Lilian Lilian le 6 Mar 2022
Undefined function or variable 'xticks'.
Error in dessiner (line 4)
xticks(x)
HWIK
HWIK le 6 Mar 2022
Modifié(e) : HWIK le 6 Mar 2022
Maybe you are using an older Matlab version, as it was introduced relatively recently, you can still do this though:
x=[0:25:200];
y1= [0.4 0.29 0.21 0.19 0.13 0.11 0.09 0.05 0.006];
y2= [0.45 0.27 0.231 0.202 0.12 0.13 0.11 0.062 0.0062];
plot(x,y1,x,y2)
set(gca,'XTick',x)

Connectez-vous pour commenter.

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by