Change x-axis values in a 2D graph

1 view (last 30 days)
Yordani
Yordani on 26 Dec 2022
Answered: Yordani on 26 Dec 2022
Hello! Could someone please tell me how I can adjust my graph number 1 so that it is the same as number 2? I want the values of [0.1-1-10] to come out, but I don't know how to do it, I'm making the blue line. Thank you
G1
G2
e_inf = 1.0 ; %Valor Correcto
Wp = 1; %Valor Correcto
gamma = 1e-3; %Valor Correcto
w1 = 0.1; %Valor Correcto
w2 = 0.1; %Valor Correcto
w3 = 10; %Valor Correcto
index = 0;
for w = w1:w2:w3
index = index + 1 ;
e(index) = e_inf - (Wp^2/w^2+1i*w*gamma);
f(index) = w;
x = f ;
y = real(e);
plot(x,y)
xlim([0 10])
ylim([-1.5 1.5])
end

Accepted Answer

Yordani
Yordani on 26 Dec 2022
thank you! :D

More Answers (1)

VBBV
VBBV on 26 Dec 2022
Edited: VBBV on 26 Dec 2022
e_inf = 1.0 ; %Valor Correcto
Wp = 1; %Valor Correcto
gamma = 1e-3; %Valor Correcto
w1 = 0.1; %Valor Correcto
w2 = 0.1; %Valor Correcto
w3 = 10; %Valor Correcto
index = 0;
K = w1:w2:w3;
for w = 1:length(K)
index = index + 1 ;
e(index) = e_inf - (Wp^2/K(w)^2+1i*K(w)*gamma);
f(index) = K(w);
x(index) = f(index) ;
y(index) = real(e(index));
end
semilogx(x,y)
xlim([0 10])
ylim([-1.5 1.5])
grid
xticklabels({'0.1','1','10'})

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!