Azzera filtri
Azzera filtri

can you help me create the program for plotting the graph of this discontinuous signal equation?

1 visualizzazione (ultimi 30 giorni)
the equation is: S(t)= { 2t, 0<t<0.5 { 1/3(4-2t) 0.5<t<2 { 0 elsewhere

Risposte (1)

Rick Rosson
Rick Rosson il 4 Lug 2011
Please try the following steps:
1. Decide on a sampling rate Fs in samples per second, or alternatively, decide on a time increment dt in seconds per sample. Once you choose one or the other of these parameters, then compute the second parameter as the reciprocal. For example:
Fs = 100; % samples per second
dt = 1/Fs; % seconds per sample
2. Define the time domain based on the time increment, the start time, and the stop time:
StartTime = 0;
StopTime = 2;
t = StartTime:dt:StopTime-dt;
3. Create two signals x and y, one for each of the two equations that you want to represent:
x = 2*t;
y = (4-2*t)/3;
4. Create a logical signal (valued at 0 or 1) to distinguish between the two time regions that define which of the two equations is in play:
u = (t<0.5);
5. Create the final signal S from the two separate signals x and y, and the locical control signal u.
HTH.

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by