paths
Scattering network paths
Description
Examples
Create two wavelet scattering networks, both for a signal of length 500. In the second network, set the OptimizePath value to true.
sf = waveletScattering(SignalLength=500);
sfOpt = waveletScattering(SignalLength=500, ...
OptimizePath=true);Obtain the path information of the default and path-optimized networks. Determine the total number of scattering paths in both networks.
[spaths,npaths] = paths(sf); [spathsOpt,npathsOpt] = paths(sfOpt); fprintf('Default Network: %d paths\nOptimized Network: %d paths\n', ... sum(npaths),sum(npathsOpt));
Default Network: 65 paths Optimized Network: 52 paths
Both networks have two filter banks. Visualize the scattering paths that include the wavelets in the second filter bank. Create a directed graph. For every wavelet filter that is on at least one path, label the corresponding node as waveletNumber.filterbank. For each path, connect the corresponding nodes. Use the helper function helperPlotScatteringGraph to construct the graphs. Plot the graphs of both networks.
scatGraph = helperPlotScatteringGraph(spaths);
plot(scatGraph)
title({"Scattering Paths", ...
"OptimizePath: "+num2str(sf.OptimizePath)})
figure
scatGraphOpt = helperPlotScatteringGraph(spathsOpt);
plot(scatGraphOpt)
title({"Scattering Paths", ...
"OptimizePath: "+num2str(sfOpt.OptimizePath)})
Supporting Functions
plotScatteringGraph
function dirGraph = helperPlotScatteringGraph(networkPaths) % This function is intended for use only in this example. % It may change or be removed in a future release. path = networkPaths{3}.path; % Set to 0 if want to plot the multiple paths between 0 and each % first level node mkunique = 1; if mkunique == 1 f1 = path(:,1:2); c = unique(f1,'rows'); else c = path(:,1:2); end p1 = string(c(:,1)); p2 = string(c(:,2)+.1); p3 = string(path(:,2)+.1); p4 = string(path(:,3)+.2); dirGraph = digraph([p1;p3],[p2;p4]); end
Since R2025b
Create two wavelet scattering networks, both for a signal of length 500. The default value of the network property FilterDownsampling is "fullband". In the second network, set FilterDownsampling to "bandlimited".
sfFull = waveletScattering(SignalLength=500); sfBand = waveletScattering(SignalLength=500, ... FilterDownsampling="bandlimited");
Use the object function filterbank to obtain the filter bank metadata from both networks. Compare the downsampling factors of the wavelet filters in the first filter bank. Confirm that the filters in the network sfBand have been downsampled less than the filters in sfFull.
fb = 1;
[~,~,metaDataFull] = filterbank(sfFull);
[~,~,metaDataBand] = filterbank(sfBand);
downSamplingFactors.full = metaDataFull{fb+1}.psilog2ds;
downSamplingFactors.band = metaDataBand{fb+1}.psilog2ds;
plot(downSamplingFactors.full,'x-')
hold on
plot(downSamplingFactors.band,'o-')
hold off
grid on
title("First Filter Bank Downsampling Factors")
xlabel("Wavelet Filter Index")
ylabel({"Downsampling Factor", ...
"(Base-2 Logarithmic Scale)"})
legend("""fullband"" Network", ...
"""halfband"" Network", ...
Location="northwest")
Obtain the path information of both networks. Determine the total number of scattering paths in both networks.The outputs of the first filter bank in the network sfBand are less downsampled than the first filter bank outputs in the network sfFull. The result is that sfBand has a greater number of scattering paths than the sfFull network.
[spathsFull,npathsFull] = paths(sfFull); [spathsBand,npathsBand] = paths(sfBand); fprintf("""fullband"" Network: %d paths\n", ... sum(npathsFull))
"fullband" Network: 65 paths
fprintf("""bandlimited"" Network: %d paths\n", ... sum(npathsBand))
"bandlimited" Network: 159 paths
Visualize the scattering paths in both networks that include the wavelets in the second filter bank. Create a directed graph. For every wavelet filter that is on at least one path, label the corresponding node as waveletNumber.filterbank. For each path, connect the corresponding nodes. Use the helper function helperPlotScatteringGraph to construct the graphs. Plot the graphs of both networks.
scatGraphFull = helperPlotScatteringGraph(spathsFull);
plot(scatGraphFull)
title("Scattering Paths: ""Fullband""")
figure
scatGraphBand = helperPlotScatteringGraph(spathsBand);
plot(scatGraphBand)
title("Scattering Paths: ""Bandlimited""")
Supporting Functions
plotScatteringGraph
function dirGraph = helperPlotScatteringGraph(networkPaths) % This function is intended for use only in this example. % It may change or be removed in a future release. path = networkPaths{3}.path; % Set to 0 if want to plot the multiple paths between 0 and each % first level node mkunique = 1; if mkunique == 1 f1 = path(:,1:2); c = unique(f1,'rows'); else c = path(:,1:2); end p1 = string(c(:,1)); p2 = string(c(:,2)+.1); p3 = string(path(:,2)+.1); p4 = string(path(:,3)+.2); dirGraph = digraph([p1;p3],[p2;p4]); end
Input Arguments
Wavelet time scattering network, specified as a waveletScattering object.
Output Arguments
Scattering paths, returned as a NO-by-1 cell array of MATLAB tables, where NO is the number of orders of the scattering network.
Each MATLAB table in spaths contains three variables:
path— Scattering network paths. In the kth element ofspaths,pathis a N-by-k matrix where each row contains a path from the input data through the (k-1)th wavelet filter bank. For example, when k equals 1, N is equal to 1 and the only path is 0 denoting the input data. When k equals 2, N is equal to the number of wavelet filters in the first filter bank andpathis a N-by-2 matrix describing the path from the input data, 0, through the wavelet filters in the first filter bank. The second column ofpathcontains the wavelet filters in the first filter bank ordered by decreasing center frequency.log2ds— The incremental base-2 log downsampling factor for the scalogram coefficients corresponding to the cumulative path in the same row.log2res— The base-2 log resolution of the scalogram coefficients corresponding to the cumulative path in the same row.
Number of wavelet scattering paths in the network by order, returned as a vector.
npaths is a NO-by-1 vector where
NO is the number of orders in the network. The
ith element of npaths contains the number of
scattering paths in the (i-1)th order. The sum of the elements of
npaths is the total number of scattering paths.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
Version History
Introduced in R2021a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)