calculate log frequency sweep such that start frequency and stop frequency are always exactly included

This commit is contained in:
Pascal Kuthe 2022-11-13 16:16:38 +01:00 committed by Holger Vogt
parent c4247c4353
commit ffe920117c
1 changed files with 3 additions and 2 deletions

View File

@ -86,8 +86,9 @@ ACan(CKTcircuit *ckt, int restart)
fprintf(stderr, "ERROR: AC startfreq <= 0\n");
return E_PARMVAL;
}
job->ACfreqDelta =
exp(log(10.0)/job->ACnumberSteps);
double num_steps = floor(fabs(log10(job->ACstopFreq/job->ACstartFreq))*job->ACnumberSteps);
job->ACfreqDelta = exp((log(job->ACstopFreq/job->ACstartFreq))/ num_steps);
break;
case OCTAVE:
if (job->ACstartFreq <= 0) {