Matlab - Calculo de Duty Cycle

 
Vista:

Calculo de Duty Cycle

Publicado por Pelu (1 intervención) el 12/12/2014 19:20:55
Hola,
Necesito su ayuda
Estoy haciendo un programa que me calcule el Duty Cycle de archivos.txt, donde se encuentra el tiempo de sampleo (columnas) e el instantes ON/OFF representados como 1/0 (filas).
Para ellos use la funcion dutycycle y me guie en http://www.mathworks.com/help/signal/ref/dutycycle.html?searchHighlight=DUTYCYCLE#outputarg_NEXTCROSS

D = dutycycle(X,T) specifies the sample instants, T, as a vector with the same number of elements as X.

Sin embargo, cuando corro el programa, me calcula un Duty Cycle que no coincide con el que calculo en papel y sé que estan bien.

Les adjunto el programita y desde ya muchas graciaaas!

j=1;
[ndata, textD]= xlsread(ArchivoOnOff, 'Estado');
Lineas = ndata(3:end,2:end);
tiempo = ndata(2,:);

for k = 1:length(Lineas)

DC = dutycycle(Lineas(k,2:end),tiempo);

if (isempty(DC))
DC = Lineas(k,end);
end

DutyCycle(j,1) = mean(DC); % Duty promedio
j= j+1;

end
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder