How to program a no periodic impulse train

조회 수: 1 (최근 30일)
Mauricio Galván García Luna
Mauricio Galván García Luna 2017년 8월 16일
답변: José-Luis 2017년 8월 16일
I have to write a program able to change the time interval of the impulse train. I mean... the first 10 seconds it has a x time interval then the next X, a random time, increasing or decreasing the time interval till it reaches the maximum time set at the beginning. Hope someone could help me.
  댓글 수: 6
José-Luis
José-Luis 2017년 8월 16일
편집: José-Luis 2017년 8월 16일
I don't get it.
Please read the documentation on linspace()
It sounds like an indexing problem.
Mauricio Galván García Luna
Mauricio Galván García Luna 2017년 8월 16일
Mmm I don't know if it could be clearer like this
I just want to know if it would be possible to be changing the hit before it reaches the 10 s
In the first 3 s hit= 1000 in the next 4 s hit= 500 in the final 3 seconds hit=40

댓글을 달려면 로그인하십시오.

채택된 답변

José-Luis
José-Luis 2017년 8월 16일
intervals = [3,4,3];
hits = [1000,500,40];
result = cell(1,3);
cnt = 0;
beginning = 0;
for ii = [cumsum(intervals);hits]
cnt = cnt + 1;
result{cnt} = linspace(beginning,ii(1),ii(2)+1);
beginning = ii(1);
end
result = unique(cell2mat(result));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Measurements and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by