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

2 ビュー (過去 30 日間)
Kidist Getu
Kidist Getu 2016 年 10 月 14 日
回答済み: Pritesh Shah 2016 年 10 月 15 日
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)); _ _ |
*# * italic*|__
  1 件のコメント
Josh
Josh 2016 年 10 月 15 日
Since xd1 and xd2 are extremely small numbers, then your step size should be smaller. Change x = xd1:0.01:xd2 to x = xd1:xd1/100:xd2.
Also, you must insert a "." before the division where you define k. Change that line of code to the following: k = sqrt(es)./(4*pi*q*sqrt(l)*sqrt(a)*(2.2e5)*x.^1.5);
Copy and paste the code below excluding the first and last lines
if true
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:xd1/100: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));
end

サインインしてコメントする。

回答 (1 件)

Pritesh Shah
Pritesh Shah 2016 年 10 月 15 日
x is scalar. That is main reason. use linspace command to create different samples between xd1 and xd2.
e.g, linspace(xd1,xd2,100)
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 =linspace(xd1,xd2,100); 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))

Community Treasure Hunt

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

Start Hunting!

Translated by