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 CenterFile Exchange 中查找有关 Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by