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!