- cwtft2 is used for calculating the 2D continuous wavelet transform.
- There are many wavelets supported by cwtft2 based on the requirement. You can find the list of those here https://www.mathworks.com/help/wavelet/ref/cwtftinfo2.html#bt1o3sf-wname
- Based on your data, you can pick one of the listed wavelets in the documentation. Here, I am using mexh as it is sensitive to changes in the signal, such as edges or singularities.
Just only cwtft2 is used for 2D continuous wavelet transform (2D CWT)?
    5 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Panida Kaewniam
 el 20 de Ag. de 2024
  
    
    
    
    
    Comentada: Panida Kaewniam
 el 22 de Ag. de 2024
            Hello everyone,
I want to detect a singularity of my data (x, y, z matrices) by using 2-dimensional continuous wavelet transform (2D CWT). My code is no error but it cannot perform the sigularity. 
My questions are
- What command can be used for 2D CWT? Just only cwtft2? From searching, the cwtft2 is 2D CWT from Fourier transform.
- What wavelet is supported for cwtft2? As I know there are few types availavle such as mexh, gaus. When I read papers, researchers who study 2D CWT can use a variety of wavelet types.
- This is my code, but i cannot detect singularity. I am not sure the problem is from my code, wavelet type, or scale. Can you reccomend?
wavelet = 'gaus';       
scales = 1:32; 
cwt_result = cwtft2(Z, 'wavelet', wavelet, 'scales', scales);
coef= cwt_result.cfs;                           
specific_scale = 10;                            
Z_wavelet = abs((coef(:,:,specific_scale)));
figure;
surf(X, Y, Z_wavelet);
 Thank you in advance
0 comentarios
Respuesta aceptada
  Shashi Kiran
 el 20 de Ag. de 2024
        I understood that you want to detect singularities of your data using  2D CWT. Below are my observations on your queries.
%% Data Generation(Replace your data)
[X, Y] = meshgrid(1:100, 1:100);
Z = zeros(size(X));
Z(40:60, 40:60) = 1;  % Introduce singularities
known_singularities = [40, 60, 40, 60]; % [x_start, x_end, y_start, y_end]
%% Set parameters for 2D CWT
wavelet = 'mexh';  % Gaussian wavelet
scales = 1:32;    
cwt_result = cwtft2(Z, 'wavelet', wavelet, 'scales', scales);
coef = cwt_result.cfs;
specific_scale = 10;
Z_wavelet = abs(coef(:, :, specific_scale));
%% Singularity Detection
threshold = 0.5 * max(Z_wavelet(:)); % Example threshold
detected_singularities = Z_wavelet > threshold;
% Visualize the wavelet coefficients and detected singularities
figure;
surf(X, Y, Z_wavelet);
title(['2D CWT Coefficients at Scale ', num2str(specific_scale)]);
xlabel('X');
ylabel('Y');
zlabel('Wavelet Coefficient Magnitude');
hold on;
% Highlight detected singularities
[detected_x, detected_y] = find(detected_singularities);
scatter3(detected_x, detected_y, Z_wavelet(detected_singularities), 'r', 'filled');
%% Comapring Detected and known singularities
matches = 0;
x_range = known_singularities(1):known_singularities(2);
y_range = known_singularities(3):known_singularities(4);
for i = 1:length(detected_x)
    if ismember(detected_x(i), x_range) && ismember(detected_y(i), y_range)
        matches = matches + 1;
    end
end
disp(['Number of matches: ', num2str(matches)]);
disp(['Total detected singularities: ', num2str(length(detected_x))]);
Refer the below documentation for further information.
Más respuestas (0)
Ver también
Categorías
				Más información sobre Continuous Wavelet Transforms 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!


