draw two curves in matlab

1 Ansicht (letzte 30 Tage)
Lilian Lilian
Lilian Lilian am 6 Mär. 2022
Bearbeitet: HWIK am 6 Mär. 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)

Antworten (1)

HWIK
HWIK am 6 Mär. 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 Kommentare
Lilian Lilian
Lilian Lilian am 6 Mär. 2022
Undefined function or variable 'xticks'.
Error in dessiner (line 4)
xticks(x)
HWIK
HWIK am 6 Mär. 2022
Bearbeitet: HWIK am 6 Mär. 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)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by