Continuous signal, Can anyone help me?

3 views (last 30 days)
Continuous signal. The signal must be a sum of steps and the user to choose the number of steps and each step also defines the initial time and amplitude, as follows. x (t) = a1u(t-t1)+a2u(t-t2) + …
Can anyone help me

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 2 Nov 2013
t=0:0.01:10
a1=1;
a2=4;
t1=1;
t2=3;
y=a1*heaviside(t-t1)+a2*heaviside(t-t2)
plot(t,y)
  11 Comments
Manuel
Manuel on 2 Nov 2013
Is correct can explain me this last 3 code lines?
Azzi Abdelmalek
Azzi Abdelmalek on 2 Nov 2013
Try this one, simple to understand
t=0:0.01:100
Deg=input('Input number:\n');
out=zeros(1,numel(t));
for x = 1:Deg
a(x)=input('input amplitude:\n');
i(x)=input('input initial time:\n');
out=out+a(x)*heaviside(t-i(x))
end
plot(t,out)

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!