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