Problems with the Y axis of my 2D graph

2 views (last 30 days)
Hello! Could someone please help me, I want my graph 1 to look like graph 2 but I don't know how to fix the Y axis. :(
it's for the blue line.
1)
2)
My code:
%Permitividad Parte Real
e_inf = 11.7 ;
Wp = 1.0856e11;
gamma = 2.3518e9 ;
w1 = 1e13;
w2 = 1e13;
w3 = 1e15;
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)

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 30 Dec 2022
Edited: Sulaymon Eshkabilov on 30 Dec 2022
Take smaller step size for w, eg.:
e_inf = 11.7 ;
Wp = 1.0856e11;
gamma = 2.3518e9 ;
w1 = 1e11;
w2 = 1e10;
w3 = 1e15;
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, 'linewidth', 2), grid on
% It is better to use this syntax of the code:
e_inf = 11.7 ;
Wp = 1.0856e11;
gamma = 2.3518e9 ;
w1 = 1e11;
w2 = 1e10;
w3 = 1e15;
index = 0;
K = w1:w2:w3;
% Loop is not necessary!
e = e_inf - ((Wp^2)./K.^2+1i*K*gamma);
f=K;
x=f;
y = real(e);
semilogx(x,y, 'linewidth',2), grid on

More Answers (0)

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!