Generate user-defined signal

7 ビュー (過去 30 日間)
Phil U
Phil U 2016 年 10 月 22 日
回答済み: Jan 2016 年 10 月 22 日
I want to generate a user-defined signal (either with Matlab and / or Simulink):
In the diagram above, you can see two plots. The upper signal represents the "trigger" for the lower signal. As soon as the trigger changes from 0 to 1, the desired output-signal should also change from 0 to 1. In contrast to the trigger-signal, the output-signal changes with some time delay. As drawn in the diagram, the change between 0 and 1 can be simple straight-line equation (f(t) = mt + y). However, it would be great if the trigger-signal could also initiate some non-linear transition (e.g. a parabolic function).
As the trigger changes from 1 to 0, the output-signal should change with the same specific transition (e.g. a linear or non-linear).
I know the time that it takes to change from state 0 to state 1 in the signal-plot. Furthermore, I know the formula which describes the transition from 0 to 1 (and from 1 to 0). However, I am not able to bring everything together in order to recieve the desired output-signal.
Can you please help me?
Regards, Phil
  1 件のコメント
Jan
Jan 2016 年 10 月 22 日
In which form is your initial signal available? As vector with a certain frequency?

サインインしてコメントする。

採用された回答

Jan
Jan 2016 年 10 月 22 日
signal = [0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0];
t = 1:length(signal);
d = diff(signal);
on = find(d == 1);
off = find(d == -1);
f = zeros(1, length(signal));
f(on:on + 3) = linspace(0, 1, 4); % Linear ascend
f(on + 4:off - 1) = 1;
f(off:off + 3) = linspace(1, 0, 4) .^ 2; % Quadratic descent
plot(t, f, 'r', t, signal, 'b')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by