Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Adaptive Minimization for loop
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!