Sliding window integrator in matlab code
古いコメントを表示
Hi, I want to implement sliding window integration using matlab code. I know its easy to implement in simulink(its taking large time due to large computation data). but i need this in matlab code. Can any one please provide hints how can i proceed. I have signal with pulse period of 5seconds and my signal is high from 2 to 3 sec.I want to integrate signal only during this period 2 to 3sec.
thank you. NTR
回答 (1 件)
Fangjun Jiang
2011 年 11 月 14 日
0 投票
The key function is conv().
7 件のコメント
NTR
2011 年 11 月 14 日
Fangjun Jiang
2011 年 11 月 14 日
If you give a small example data and the expected output, others might help to figure it out.
NTR
2011 年 11 月 14 日
Fangjun Jiang
2011 年 11 月 14 日
Yes. I would say just multiplying your signal with a square wave signal and then sum the results.
Fangjun Jiang
2011 年 11 月 14 日
Or use logical index.
t=0:5;
signal=rand(size(t));
selection=and(2<=t,t<=3);
r=sum(signal(selection))
NTR
2011 年 11 月 15 日
Fangjun Jiang
2011 年 11 月 15 日
I don't understand what you are talking about. If signal=rand(6,1), selection=[0 0 1 1 0 0], then r=selection*signal is the same as above, the sum of the value at t==2 and t==3.
カテゴリ
ヘルプ センター および File Exchange で Numerical Integration and Differentiation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!