Generate user-defined signal
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Jan
le 22 Oct 2016
In which form is your initial signal available? As vector with a certain frequency?
Réponse acceptée
Jan
le 22 Oct 2016
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Signal Generation, Manipulation, and Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!