How to change the sample time?

20 次查看(过去 30 天)
Hello,
Only I want is recording a data to workspace with scope.
There is data like below (from workspace):
[t , v]
0.0 , 4.5
0.1 , 4.45
0.2 , 4.43
0.3 , 4.3
... , ...
10.0 , 4.0
20.0 , 4.1
30.0 , 4.15
..., ...
10000.0 , 4.2
A sampling time of part of data has a value per 0.1sec, the other part has a value per 10sec. (it can be larger than 10sec)
After some calculation, I wolud like to record this data using a scope. But I can set only one sampling time value in the scope parameter. TT
If I set the sampling time 0.1sec, the data is too much, and if I set the sampling time 10sec, the 0.1sec data are gone.
Accoring to input(from workspace block), I would like to change the sampling time. is it possible? or how can I fix this problems...?
  2 个评论
Azzi Abdelmalek
Azzi Abdelmalek 2012-12-5
It's not clear, you have data from workspace, and you want to export those data to workspace!
sewook
sewook 2012-12-6
My purpose is comparing original data and simulated data, so the sampling time should be matched. Thank you for your advice. In case of long data, I should find another methoad about it.

请先登录,再进行评论。

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2012-12-5
For each signal use one scope with it's sample time
  2 个评论
sewook
sewook 2012-12-6
there is only one signal. The signal has different sample time like above.(some signal has 0.1sec sample time, some signal has 10sec sample time.)
Azzi Abdelmalek
Azzi Abdelmalek 2012-12-6
Ok, then don't use sample time in your scope, let sampling option on decimation

请先登录,再进行评论。

更多回答(1 个)

TAB
TAB 2012-12-6
编辑:TAB 2012-12-6
It is not possible to log the same signal with different sample time. For your case use lowest sample time (0.1 sec) to log the scope data. From the logged data you can extract the values at sample times you need.
For example ScopeData is the variable logged by scope. You can extract your values as
Myt1 = [0.0:0.1:0.3]';
Myt2 = [10:10:1000]';
[~, Idx1, ~] = intersect(ScopeData.time,Myt1);
[~, Idx2, ~] = intersect(ScopeData.time,Myt2);
MyValues = [ScopeData.signals.values(Idx1) ; ScopeData.signals.values(Idx2)];

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by