- (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
조회 수: 2 (최근 30일)
이전 댓글 표시
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1108860/image.jpeg)
댓글 수: 0
채택된 답변
Cris LaPierre
2022년 8월 26일
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
Cris LaPierre
2022년 8월 26일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!