MATLAB: Do I receive a “Sample time of input to RF block incorrectly specified” error, even though all the sample times are correctly specified, when using the RF Blockset 2.0 (R2007a)

RF Blockset

I get the following error when running my model:
Sample time of input to RF block incorrectly specified
This occurs even though I have checked to make sure all my sample times are correctly specified.

Best Answer

This enhancement has been incorporated in Release 2008a (R2008a). For previous product releases, read below for any possible workarounds:
This error may occur when the value given for the sample time of the RF block does not exactly match the sample time of the block driving it. The most common causes of this error are (1) a typing mistake, and (2) an error due to numerical precision. The following is an example of how such a numerical round off error could occur:
sample_rate = 1931; % Hz
sample_period = 1/sample_rate; % s
round_off = sample_rate*sample_period - 1
If you believe that you have correctly set the sample time of your RF block, and you are still receiving this error, you should test the sample time of the driving signal using the "Probe" block. The two models "RF_SampletimeError_1.mdl" and "RF_SampletimeError_2.mdl" demonstrate how to do this.
In "RF_SampletimeError_1.mdl", a buffered signal is being passed into a "Bandpass RF Filter" block and the following error results when you run the model:
Error reported by S-function 'scomrfcheck1' in 'RF_SampletimeError_1/Bandpass RF Filter/RF Filter/RF Checker':
Sample time of input to RF block incorrectly specified.
This indicates that there is a sample time mismatch between what the sample time of the "Bandpass RF Filter" block is set to and the sample time of the signal it is accepting. To resolve this, we need to use the "Probe" block to measure the sample time of the driving signal.
Open "RF_SampletimeError_2.mdl". You will see that we replaced the "Bandpass RF Filter" block and everything downstream with a setup to compare "1/31584" against the measured sample time. You will notice that there is a very small difference between the two.
As a last step we need to find out what that small difference is. The difference is due to round off error and is likely within a few EPS of the true value. The bottom path of "RF_SampletimeError_2.mdl" shows that "1/31584 + eps(1/31584)" is the correct value (although sometimes you will need to try 2*eps(), 3*eps(), etc).
If you open "RF_SampletimeError_1.mdl" and insert "1/31584 + eps(1/31584)" into the "Sample time" field, the model should run without error.