Wavelet scattering display problem
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Abdelhakim Souidi
el 17 de Jul. de 2023
Comentada: Anavi Somani
el 18 de Jul. de 2023
Dear All,
I have a problem with Scattergram, when I use wavelet scattering coefficients to plot the scattergram it displays like this:
but when I store the scattergam in data variable and try to plot the contour of it, the image is reversed and I lost the axis (time, frequency) as the following picture:
Here is the code and the signal :
fs =2000;
sf = waveletScattering('SignalLength',numel(pcg),...
'SamplingFrequency',fs);
[S,U] = scatteringTransform(sf,pcg);
% Normal case
figure,
scattergram(sf,U,'FilterBank',1);
% Abnormal case
img = scattergram(sf,U,'FilterBank',1);
contour(img)
if could anyone help with this problem, I'll appreciate it
0 comentarios
Respuesta aceptada
Anavi Somani
el 18 de Jul. de 2023
Hi,
The issue you're facing with the reversed scattergram image and the lost axis when plotting the contour could be due to the difference in the default coordinate system used by `scattergram` and `contour` functions in MATLAB.
The `scattergram` function plots the scattergram with time on the x-axis and frequency on the y-axis by default. However, the `contour` function assumes that the first dimension of the image corresponds to the y-axis and the second dimension corresponds to the x-axis.
To address this issue and correctly plot the contour with the appropriate axis labels, you can modify the code as follows:
fs = 2000;
sf = waveletScattering('SignalLength', numel(pcg), 'SamplingFrequency', fs);
[S, U] = scatteringTransform(sf, pcg);
% Normal case
figure
scattergram(sf, U, 'FilterBank', 1);
% Abnormal case
img = scattergram(sf, U, 'FilterBank', 1);
contour(flipud(img), 'XData', sf{1}.time, 'YData', sf{1}.log2Scales)
xlabel('Time')
ylabel('Frequency')
In the modified code, the `flipud` function is used to flip the image vertically, aligning it with the expected orientation for the `contour` function. Additionally, the `XData` and `YData` parameters are provided to specify the correct axis labels for the contour plot.
By incorporating these changes, you should be able to plot the contour of the scattergram with the correct orientation and axis labels.
Hope it helps.
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Wavelet Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!