Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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 visualización (últimos 30 días)
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));

Respuestas (1)

Star Strider
Star Strider el 14 de Oct. de 2016
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’

La pregunta está cerrada.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by