Using Matlab perform the convolution of the following signals of different duration and energy
12 views (last 30 days)
Show older comments
S1 is a rectangular pulse that has amplitude 1 width 1
S2 is a rectangular pulse that has amplitude 1 width 1.5
S3 is a rectangular pulse that has amplitude 1 width 3
I have been trying to figure out how to get the rectangularPulse function to work, but I keep getting errors telling me that I have an invalid number of arguments, please look over my script and tell me what needs to be corrected and how to do so, thank you.
t1 = 0:1;
s1 = rectangularPulse(t1, 1);
t2 = 0:1.5;
s2 = rectangularPulse(t2, 1);
t3 = 0:3;
s3 = rectangularPulse(t3, 1);
conv12 = conv(s1, s2);
conv13 = conv(s1, s3);
conv23 = conv(s2, s3);
figure;
subplot(3,1,1);
plot(conv12);
title("S1 * S2");
subplot(3,1,2);
plot(conv13);
title("S1 * S3");
subplot(3,1,3);
plot(conv23);
title("S2 * S3");
1 Comment
Walter Roberson
on 19 Jan 2023
By the way, are those single rectangular pulses, or are they a repeated rectangular pulse chain ?
Answers (2)
Walter Roberson
on 19 Jan 2023
Edited: Walter Roberson
on 19 Jan 2023
the function accepts 1 argument or 3 arguments but not two arguments.
0 Comments
Paul
on 19 Jan 2023
Hi Ali,
Assuming S1, S2, and S3 are continuous-domain signals, I think it would be better to compute the convolution integral using int. Examples on this forum are easily found, including those that use rectangularPulse.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!