Modulation​Classifica​tionWithDe​epLearning​Example 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 =
dlnetwork with properties:
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
Error using coder.const (line 13)
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.

回答(1 个)

Parag
Parag 2025-4-8
Hi @Rev,
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!

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by