Problems with my 2D graph
1 view (last 30 days)
Show older comments
Hello! Can someone help me to make my graph 2 look like number 1 please? I want the Y axis to be the same
1)
2)
Code
e_inf = 11.7 ;
Wp1 = 1.0856e11;
gamma1 = 2.3518e9 ;
Wp2 = 3.4330e11;
gamma2 = 5.6747e9 ;
Wp3 = 1.0856e12;
gamma3 = 8.8952e9 ;
Wp4 = 3.4330e12;
gamma4 = 3.2292e10;
w1 = 1e13;
w2 = 1e10;
w3 = 1e15;
index = 0;
K = w1:w2:w3;
% Loop is not necessary!
e1 = e_inf - ((Wp1^2)./K.^2+1i*K*gamma1);
e2 = e_inf - ((Wp2^2)./K.^2+1i*K*gamma2);
e3 = e_inf - ((Wp3^2)./K.^2+1i*K*gamma3);
e4 = e_inf - ((Wp4^2)./K.^2+1i*K*gamma4);
f=K;
x=f;
figure
y1 = real(e1);
semilogx(x,y1, 'b-','linewidth',2, 'displayName', 'e_1')
hold on
y2 = real(e2);
semilogx(x,y2, 'g-', 'linewidth',2,'displayName', 'e_2'), grid on
y3 = real(e3);
semilogx(x,y3, 'r-', 'linewidth',2,'displayName', 'e_3'), grid on
y4 = real(e4);
semilogx(x,y4, 'black-', 'linewidth',2,'displayName', 'e_4'), grid on
hold off
legend('toggle');
8 Comments
Walter Roberson
on 30 Dec 2022
You cannot see separate lines because when you expand the y axis to cover the same range as the other plot, then the data available for this plot has too little variation in y range to show separate lines.
Walter Roberson
on 30 Dec 2022
Your example plot has legend items such as 10^21 but I do not see which variable values that is intended to correspond to?
Answers (1)
Sulaymon Eshkabilov
on 31 Dec 2022
Edited: Sulaymon Eshkabilov
on 31 Dec 2022
Here is the corrected code:
e_inf = 11.7 ;
Wp1 = 1.0856e11;
gamma1 = 2.3518e9 ;
Wp2 = 3.4330e11;
gamma2 = 5.6747e9 ;
Wp3 = 1.0856e12;
gamma3 = 8.8952e9 ;
Wp4 = 3.4330e12;
gamma4 = 3.2292e10;
w1 = 1e13;
w2 = 1e10;
w3 = 1e15;
index = 0;
K = w1:w2:w3;
% Loop is not necessary!
e1 = e_inf - ((Wp1^2)./K.^2+1i*K*gamma1);
e2 = e_inf - ((Wp2^2)./K.^2+1i*K*gamma2);
e3 = e_inf - ((Wp3^2)./K.^2+1i*K*gamma3);
e4 = e_inf - ((Wp4^2)./K.^2+1i*K*gamma4);
f=K;
x=f;
figure
y1 = real(e1); Wp1 = 1.0856e11;
gamma1 = 2.3518e9 ;
Wp2 = 3.4330e11;
gamma2 = 5.6747e9 ;
Wp3 = 1.0856e12;
gamma3 = 8.8952e9 ;
Wp4 = 3.4330e12;
gamma4 = 3.2292e10;
loglog(x,y1, 'b-.','linewidth',2, 'displayName', '\Gamma = 2.35*10^9')
hold on
y2 = real(e2);
loglog(x,y2, 'g-', 'linewidth',2.5,'displayName', '\Gamma = 5.6747*10^9'), grid on
y3 = real(e3);
loglog(x,y3, 'r--', 'linewidth',2,'displayName', '\Gamma = 8.8952*10^9'), grid on
y4 = real(e4);
loglog(x,y4, 'k:', 'linewidth',2,'displayName', '\Gamma = 3.2292*10^{10}'), grid on
hold off
ylim([11.55 11.705])
legend('toggle'); xlabel('$\omega$', 'interpreter', 'latex'); ylabel('$Re(\epsilon)$', 'interpreter', 'latex')
1 Comment
See Also
Categories
Find more on Annotations 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!