ModulationClassificationWithDeepLearningExample Expected InterpolationFactor to be integer-valued
1 次查看(过去 30 天)
显示 更早的评论
When trying the Mathworks supplied ModulationClassificationWithDeepLearningExample I get error "Expected InterpolationFactor to be integer-valued". Specifically:
trainedNet =
Layers: [19×1 nnet.cnn.layer.Layer]
Connections: [18×2 table]
Learnables: [22×3 table]
... works down to here ...
Generating data and saving in data files...
00:00:49 - Generating 16QAM frames
00:00:52 - Generating 64QAM frames
00:00:54 - Generating 8PSK frames
00:00:55 - Generating B-FM frames
Expected InterpolationFactor to be integer-valued.
[s, numStages, filtObjs] = coder.const(@obj.designfilters, ...
setfilters(obj);
x = audioRC(audioSrc());
src = @()getAudio(spf,fs);
I traced it back to SampleRateComverter.m but the code is locked down. On my copy I round the float to integer. Just want to know how it will affect the solution.
fsrc = fdesign.rsrc(L1,M/M1,'Nyquist',max(L1,M/M1),TW1,Astop,SampleRateAfterDecim*L1); It expects L1 to be int and it is float (or decimal) which generates an error. It works now but butterfly effect?
Thank you in advance.
0 个评论
回答(1 个)
Parag
2025-4-8
The “dsp.SampleRateConverter” function in MATLAB requires both the “InterpolationFactor” and “DecimationFactor” to be integer-valued. The error occurs because the expected `InterpolationFactor` is not integer-valued, likely due to a floating-point value derived from a sample rate ratio being passed into it.
Rounding the interpolation factor to an integer is a good workaround. For deep learning training, such as in the Modulation Classification example, this typically has minimal impact, especially if the rounded factor still produces a resampling ratio close to the original. Deep learning models are generally resilient to slight timing or sampling variations in the input.
However, rounding can slightly alter the effective sample rate, which may affect signal fidelity in edge cases—particularly for classes like ‘B-FM’ that are sensitive to frequency content. To ensure the resampling ratio is accurately maintained, consider enhancing the approach by using:
[L, M] = rat(desiredRatio, 1e-6); % Rational approximation to keep integers
This method keeps both factors as integers while closely matching the original ratio.
Refer to the following MathWorks documentation for more information:
Hope it works!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!