Borrar filtros
Borrar filtros

Folks: My program (below) does not return an error message, it does open a plot window, but no graph/data is plotted. I am not sure why. Thank you for your help. H Daniel

1 visualización (últimos 30 días)
clear all;
neff=1.45;
dn=3.5 *(10^-4);
lambdad=1550;
Lmm=20.0;
L=Lmm*(10^6);
INPUT=[1;0];
dx=0.1;
for lambda=1549:dx:1551
k=(pi*dn)/lambda;
sigma=2*pi*neff*((1/lambda)-(1/lambdad));
gamma2=(k^2)-(sigma^2);
gamma=sqrt(gamma2);
gL=gamma*L;
sg=sigma/gamma;
kg=k/gamma;
%
F111=cosh(gL)-j*sg*sinh(gL);
F112=-j*kg*sinh(gL);
F121=j*kg*sinh(gL);
F122=cosh(gL)+j*sg*sinh(gL);
%
F=[F111,F112;F121,F122];
OUT=F*INPUT;
R1=OUT(1);
R2=OUT(2);
REFLECTION=abs(R2/R1);
hold on
grid on
plot (lambda,REFLECTION);
end

Respuesta aceptada

per isakson
per isakson el 6 de Nov. de 2017
Editada: per isakson el 6 de Nov. de 2017
Plotting one value at a time as line doesn't work. Line is default. Two values are needed to make a line.
Replace
plot (lambda,REFLECTION );
by
plot (lambda,REFLECTION, 'd' );
to plot diamond markers
However, a maybe better solution would be to build vectors inside the loop and plot the vectors after the loop.

Más respuestas (1)

hani daniel
hani daniel el 6 de Nov. de 2017
Hi Isakson,
Thank you for answering my question.
H Daniel

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by