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

1 次查看(过去 30 天)
the equation is: S(t)= { 2t, 0<t<0.5 { 1/3(4-2t) 0.5<t<2 { 0 elsewhere

回答(1 个)

Rick Rosson
Rick Rosson 2011-7-4
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.

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by