function dibujaSignal(signal, binario, frec, grafActivas,...
nTrama, repFrec, color, actSup, radioBut)
%------------------------------------------------------------------------
%| dibujaSignal(signal, binario, frec, grafActivas,...
%| nTrama, repFrec, color, actSup)
%------------------------------------------------------------------------
%| Funcin que actualiza uno de las dos grficas, bien la
%| superior, bien la inferior.
%|
%| NO REALIZA VALIDACIN DE PARMETROS DE ENTRADA
%|
%| Entradas:
%| 1.- SIGNAL = seal a representar.
%| 2.- BINARIO = secuencia binaria que lleva
%| 3.- GRAF_ACTIVAS= vector fila de dos elementos.
%| [Activa Graf. Sup., Activa Graf. Inf.]
%| 4.- N_TRAMA = entero con el nmero de trama a representar
%| 5.- REP_FREC = bandera: 0 = rep. temporal; 1= rep. espectral
%| 6.- FREC = vector fila [Rb fi fs].
%| 7.- COLOR = cadena de caracteres con el color 'g', 'b', etc.
%| 8.- ACT_SUP = Se actualiza grfica superior(=1) o inferior(=0)?
%-------------------------------------------------------------------------
% Autor: Cesar Delgado
% Fecha: 19-Abril-2.004
%-------------------------------------------------------------------------
if nargin<8, % Eliminamos todas las representaciones
subplot('position',[0.07, 0.95, 0.6, 0.04]);
plot(0);
axis off;
subplot('position',[0.07, 0.90, 0.6, 0.04]);
plot(0);
axis off;
subplot('position',[0.07, 0.027, 0.6, 0.04]);
plot(0);
axis off;
enfocaEje([1 0], 0);
plot(0);
axis off;
else,
%%%%%% Ctes.
gSUP = 1; gINF = 2;
fs = frec(3);
L = frec(3)/frec(1); % N muestras/bit
% 1.- Clculos previos
%---------------------
if ~repFrec, % Representacin temporal
inf = (nTrama-1)*(length(signal))*(1/fs);
sup = nTrama*length(signal)*(1/fs);
eje = inf:((sup-inf)/(length(signal)-1)): sup;
tituloX = 'Tiempo (sg.)';
tituloY = 'Amplitud (V)';
else, % Representacin Espectral
autocor = xcorr(signal, signal);
eje = -(fs/2):(fs/(length(autocor)-1)):(fs/2);
aux = abs(fftshift(fft(autocor)));
signal = 10*log10((1e-3)*aux/100);
clear aux autocorr
if fs > 1e7,
eje = eje.*1e-6;
tituloX = 'Frecuencia (MHz)';
elseif fs > 1e4,
eje = eje.*1e-3;
tituloX = 'Frecuencia (kHz)';
else,
tituloX = 'Frecuencia (Hz)';
end;
tituloY = 'Potencia (dBm) sobre 50 \Omega';
L = 2*L;
end;
% 2.- Representacin en la grfica adecuada
%------------------------------------------
% 2.1.- Representacion de Bits
if grafActivas(gSUP) & grafActivas(gINF),
if actSup,
h = subplot('position',[0.065, 0.94, 0.6, 0.04]);
bar(1:L:length(signal), binario, color);
if repFrec, plot(0); end;
axis tight;
axis off;
else,
h = subplot('position',[0.065, 0.47, 0.6, 0.04]);
bar(1:L:length(signal), binario, color);
if repFrec, plot(0); end;
axis tight;
axis off;
end;
else
h = subplot('position',[0.065, 0.47, 0.6, 0.04]);
plot(0);
axis off;
h = subplot('position',[0.065, 0.95, 0.6, 0.04]);
plot(0);
axis off;
h = subplot('position',[0.065, 0.90, 0.6, 0.04]);
bar(1:L:length(signal), binario,color);
if repFrec, plot(0); end;
axis tight;
axis off;
end;
% 2.2.- Enfocamos la grafica adecuada
h = enfocaEje(grafActivas, actSup);
% 2.3.- Representamos en pantalla
plot(eje, signal, color);
xlabel(tituloX);
ylabel(tituloY);
axis tight;
if repFrec, axis([min(eje), max(eje), max(signal)-60, 10*round(max(signal)/10)+5]); end;
end;