Hi,

Below is a SKILL to find the Harmonic Frequency distortion level.

If I run a single simulation I get the correct answer.

However, if I run a Parametric Sweep of VAR("fin") I get the following error:

*Error* round: argument #1 should be a number (type template = "n") - drwave:213939744.

I get the error because "FreqN" is a vector.

How do I modify the script below such that it can handle a Parametric Sweep?

BTW, if freqN was a list or a vector I could make the code work with a foreach command.

However, freqN is not a list, nor is it a vector.

What is it?

#######################################################################

procedure( CCSharmonicDistNEW( tranwave dftFrom dftTo numSample freqN freq0)

let( (res dftwave newFreqN)

dftwave = dft(tranwave,dftFrom ,dftTo,numSample,"Rectangular",1,1)

newFreqN=abs(round(freqN/250e6)*250e6-freqN)

res = db20( mag(value(dftwave newFreqN))/mag(value(dftwave freq0)))

res

)

)

ocnPrint(CCSharmonicDistNEW(VT("/XQDCA/RECONSTRUCTED") 42.2n 298.2n 64 3*VAR("fin") VAR("fin")))

############################################################################################