Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
my code is running but it didn't display the graph even if it put the x and y value in the axis. here is my code
조회 수: 1 (최근 30일)
이전 댓글 표시
my code is running but it didn't display the graph even if it put the x and y value in the axis. here is my code
a=0.0001; l=0.0003; eo=8.85e-14; er=11.9; es=eo*er; f1 = 550e3; f2 = 1650e3; q=1.6e-19; c1=1/(4*pi*pi*f1*l); c2=1/(4*pi*pi*f2*l); xd1=(a*es)/c1; xd2=(a*es)/c2; n1=sqrt(es)/(4*pi*q*sqrt(l)*sqrt(a)*(2.2e5)*xd1^1.5); n2=sqrt(es)/(4*pi*q*sqrt(l)*sqrt(a)*(2.2e5)*xd2^1.5); x =xd1:0.01:xd2; k = sqrt(es)/(4*pi*q*sqrt(l)*sqrt(a)*(2.2e5)*x.^1.5); figure(1) plot(x,k) xlabel('xd'); ylabel('nd'); plot(x,log10(k));
댓글 수: 0
답변 (1개)
Star Strider
2016년 10월 14일
Your ‘x’ vector is a single point, ‘xd1’, because the step size is larger than the terminating value. Use the linspace function to create ‘x’. You also have to use the hold function and semilogy to plot and see both vectors:
a=0.0001;
l=0.0003;
eo=8.85e-14;
er=11.9;
es=eo*er;
f1 = 550e3;
f2 = 1650e3;
q=1.6e-19;
c1=1/(4*pi*pi*f1*l);
c2=1/(4*pi*pi*f2*l);
xd1=(a*es)/c1;
xd2=(a*es)/c2;
n1=sqrt(es)/(4*pi*q*sqrt(l)*sqrt(a)*(2.2e5)*xd1^1.5);
n2=sqrt(es)/(4*pi*q*sqrt(l)*sqrt(a)*(2.2e5)*xd2^1.5);
% x =xd1:0.01:xd2; % <— REPLACE WITH ‘linspace’
x = linspace(xd1, xd2, 10); % 10-Element Vector
k = sqrt(es)./(4*pi*q*sqrt(l)*sqrt(a)*(2.2e5)*x.^1.5); % <— DO ELEMENT-WISE DIVISION
figure(1)
semilogy(x,k)
xlabel('xd');
ylabel('nd');
hold on % <— ADD ‘hold’
plot(x,log10(k));
hold off % <— ADD ‘hold off’
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!