Using Matlab perform the convolution of the following signals of different duration and energy

18 ビュー (過去 30 日間)
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 件のコメント
Walter Roberson
Walter Roberson 2023 年 1 月 19 日
By the way, are those single rectangular pulses, or are they a repeated rectangular pulse chain ?

サインインしてコメントする。

回答 (2 件)

Walter Roberson
Walter Roberson 2023 年 1 月 19 日
編集済み: Walter Roberson 2023 年 1 月 19 日
the function accepts 1 argument or 3 arguments but not two arguments.

Paul
Paul 2023 年 1 月 19 日
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.

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by