Clear Filters
Clear Filters

discrete wavelet transform data format

19 views (last 30 days)
guo qing
guo qing on 8 Mar 2024
Commented: vidyesh on 12 Apr 2024 at 4:39
When I output data from SIMULINK to the workspace using the "to workspace" module in a time series format, I find that the wavelet toolbox cannot recognize it. However, when I output the data in an array format, which does not include time information, the wavelet toolbox can recognize it. I want to ask if it is correct to only analyze the numerical data without including time data? Will this not affect the frequency analysis, and is there a need to set SIMULINK to a fixed step size?Thank you very much

Accepted Answer

vidyesh
vidyesh on 4 Apr 2024 at 4:44
Hello,
Many wavelet functions are designed to analyze patterns or frequencies in your data, often without the need for direct time information. However, they might still ask for details like sampling time or frequency as additional input. In this case it is acceptable to analyze the data without the time information.
On the other hand If your analysis demands explicit time data, you might need to adapt your approach. One strategy is to handle the time data as a separate variable, integrating it into the analysis wherever necessary.
Moreover, setting your Simulink solver to a fixed step size is crucial. Digital signal processing, including wavelet analysis, typically assumes data is sampled at consistent intervals. A fixed step size guarantees this uniformity.
For more detailed guidance on managing sample times in systems, please refer to the following link:
Hope this helps.
  2 Comments
guo qing
guo qing on 10 Apr 2024 at 7:57
Thanks for your answer.Could you please elaborate on the methods for handling time? 'One strategy is to handle the time data as a separate variable, integrating it into the analysis wherever necessary.'
vidyesh
vidyesh on 12 Apr 2024 at 4:39
It depends on what the code is trying to achieve. But one example would be separating the time series into two arrays of time and numerical data. After passing the numerical data to the desired function, the corresponding time values can be calculated separately and then attached/indexed to the numerical values returned by the function.
Consider the example of convolution of two signals given below:
% Define the time series data
time1 = [1; 2; 3; 4]; % Time for the first signal
data1 = [10; 20; 30; 40]; % Data for the first signal
time2 = [1; 2; 3; 4; 5]; % Time for the second signal
data2 = [15; 25; 35; 45; 55]; % Data for the second signal
% Perform convolution on the numerical values
convData = conv(data1, data2);
% Calculate the corresponding time values for the convolution result
timeStep = time1(2) - time1(1);
% Calculate start and end time for the convolution result
convStartTime = time1(1) + time2(1) - timeStep;
convEndTime = time1(end) + time2(end) - timeStep;
% Generate the time vector for the convolution result
convTime = (convStartTime:timeStep:convEndTime).';
% Combine the time and convolved data
result = [convTime, convData];
disp(result);
1 150 2 550 3 1300 4 2500 5 3500 6 3850 7 3450 8 2200

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!