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 日
What have you tried so far?
Mauricio Galván García Luna
Mauricio Galván García Luna 2017 年 8 月 16 日
編集済み: Mauricio Galván García Luna 2017 年 8 月 16 日
I have been trying to simulate a multi-impact machine which will be changing how many impacts is giving depending how much are you triggering the machine.
Stephen23
Stephen23 2017 年 8 月 16 日
@Mauricio Galván García Luna: what have you tried so far?
Mauricio Galván García Luna
Mauricio Galván García Luna 2017 年 8 月 16 日
@Stephen Cobeldick . I am running out of ideas but my basic idea was something like this.
Now... instead of using 1000 hits in 10 seconds it should switch to 500 hits in the next 10 seconds.
hit=1000;
t=0:1/(hit-1):10;%Tiempo
imp=1;
for n=1:length(t)
M(n)=imp;
end
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 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by