Info

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

Adaptive Minimization for loop

2 visualizaciones (últimos 30 días)
Steven
Steven el 17 de Nov. de 2016
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I have a DAC that I'm calibrating by measuring the values. I use a simple search to find the minimum between a voltage I desire and the measured voltage of the DAC. (don't worry, I know how to calibrate DAC's with a polynomial but I can't do that in this case.) Instead of using a stepped search where I change the values I would like to use an adaptive approach to make the algorithm faster.
I am using hardware in the loop. How can I use an adaptive algorithm to make the minimization faster?
findvalue = 0.5;%desired voltage
flagreached = 1;%flag if done finding voltage
count = 1;
while flagreached
voltage(count) = voltagefromADC();%Measure voltage
if count > 6 %wait 6 measurements before averaging
meanv = mean(voltage(count-5:count));
if meanv< findvalue - 0.5
compdacV = compdacV + 100;
elseif meanv< findvalue - 0.05
compdacV = compdacV + 10;
elseif meanv< findvalue -0.005
compdacV = compdacV + 1;
elseif meanv <= findvalue
%found value
flagreached = 0;
end
end
changeDAC(compdacV);%Set the DAC
compdacVvec(count) = compdacV;
count = count +1;
end

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by