Problems with the Y axis of my 2D graph
2 views (last 30 days)
Show older comments
Yordani
on 30 Dec 2022
Edited: Sulaymon Eshkabilov
on 30 Dec 2022
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)
0 Comments
Accepted Answer
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
0 Comments
More Answers (0)
See Also
Categories
Find more on Particle & Nuclear Physics 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!