Problems with the Y axis of my 2D graph
2 次查看(过去 30 天)
显示 更早的评论
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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1247872/image.png)
2)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1247877/image.png)
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 个评论
采纳的回答
Sulaymon Eshkabilov
2022-12-30
编辑:Sulaymon Eshkabilov
2022-12-30
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!