Graph two curves in the same plane

1 view (last 30 days)
Hello! I'm trying to graph the function e1 and e2 in the same plane but I can't. Could you please help me :(
%Permitividad Parte Real
e_inf = 11.7 ;
Wp1 = 1.0856e11;
gamma1 = 2.3518e9 ;
Wp2 = 3.4330e11;
gamma2 = 5.6747e9 ;
w1 = 1e11;
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);
f=K;
x=f;
y1 = real(e2);
semilogx(x,y1, 'linewidth',2), grid on
hold on
y2 = real(e2);
semilogx(x,y2, 'linewidth',2), grid on
hold off

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 30 Dec 2022
To plot two curves are simple as follows:
e_inf = 11.7 ;
Wp1 = 1.0856e11;
gamma1 = 2.3518e9 ;
Wp2 = 3.4330e11;
gamma2 = 5.6747e9 ;
w1 = 1e11;
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);
f=K;
x=f;
figure
y1 = real(e1);
semilogx(x,y1, 'r-','linewidth',2, 'displayName', 'e_1')
hold on
y2 = real(e2);
semilogx(x,y2, 'b-', 'linewidth',2,'displayName', 'e_2'), grid on
hold off
legend('toggle')
  1 Comment
Walter Roberson
Walter Roberson on 30 Dec 2022
in particular you had used real(e2) for both y1 and y2

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!