필터 지우기
필터 지우기

Problems with my 2D graph

조회 수: 1 (최근 30일)
Yordani
Yordani 2022년 12월 30일
댓글: Walter Roberson 2022년 12월 31일
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');
This statement is incomplete.
  댓글 수: 8
Walter Roberson
Walter Roberson 2022년 12월 30일
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
Walter Roberson 2022년 12월 30일
Your example plot has legend items such as 10^21 but I do not see which variable values that is intended to correspond to?

댓글을 달려면 로그인하십시오.

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2022년 12월 31일
편집: Sulaymon Eshkabilov 2022년 12월 31일
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
Walter Roberson
Walter Roberson 2022년 12월 31일
No, they expect a graph in which the y4 values start about -300

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by