- (0:length(s)-1)'/Fs, where s is the signal and Fs is a scalar in the workspace representing a sample rate.
- linspace(2,2.5,length(s))', where s is the signal.
- minutes(0:15)', equivalent to taking measurements every minute for 15 minutes.
- [0:10 20:30], equivalent to taking two sets of measurements at 1 Hz with a long pause between the sets.
Signal Analyser - Time Values Query for Re-Sampling
3 views (last 30 days)
Show older comments
Hi,
I am attempting to re-sample a signal (and array of signals if possible) in the Signal Analyser app. The catpured data is imported from ANSYS which has a variable step solver. I have the captured signals (i.e., volume_03) and the time signal (t) in the workspace, all are 574x1 doubles. When I go to change the x-axis to "Time Values" and select the time signal in the worspace I encounter an error. Can a time signal be selected in this manner?
Thanks in advance
Patrick
0 Comments
Accepted Answer
Cris LaPierre
on 26 Aug 2022
It appears the time values you are using contain duplicate values (or maybe NaNs?), which is not allowed. However, yes, you can specify a variable as your time values.
See this page, which says:
Use this option when you know the time value corresponding to each sample. Specify the time values using a MATLAB expression or the name of a variable in the MATLAB workspace.
The Time Values can be stored in a numeric vector with real time values expressed in seconds. The values must be unique and cannot be NaN, but they need not be uniformly spaced. The vector must have the same length as the signal.
The time values can also be stored in a duration array. The values must be unique and cannot be NaN, but they need not be uniformly spaced. The array must have the same length as the signal.
The time values can also be entered as a MATLAB expression. The expression must specify an array with the same length as the signal. The values must be unique and cannot be NaN, but they need not be uniformly spaced. Valid examples include:
In all cases, the app derives a sample rate from the time values and displays it in the Time column of the Signal table. An asterisk preceding the sample rate indicates that the signal is nonuniformly sampled.
3 Comments
Cris LaPierre
on 26 Aug 2022
Though that may explain what is happening, what is displayed on the screen vs what is stored in memory are different. MATLAB defaults to displaying only 4 decimal places for readability. Resolution will be determined by your data type. The default data type for numbers in MATLAB is a double, which can capture between 15 and 16 decimal places resolution. Use the eps function to see what it is on your system.
You can read more on this page: https://www.mathworks.com/help/matlab/matlab_prog/floating-point-numbers.html
More Answers (0)
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!