Arrays have incompatible sizes for this operation.

조회 수: 5 (최근 30일)
Amirul Azmi
Amirul Azmi 2022년 11월 21일
답변: cr 2022년 11월 21일
t=(-1:0.001:5);
u=@(t) t>0;
h1=(2).*(heaviside(t)-heaviside(t-1));
h2=(4).*(heaviside(t)-heaviside(t-2));
h12 = conv(h1,h2);
ht= h1+h12;
% Plot out h1*h2
figure(1)
subplot(1, 1,1 );
plot(t,ht, 'b-', 'LineWidth', 2); % Just plot vs. index.
grid on;
title('Signal h(t)');
xlabel('time', 'FontSize', 12);
ylabel('amplitude h(t)', 'FontSize', 12);

답변 (1개)

cr
cr 2022년 11월 21일
Try the following change in conv() call on line 5.
h12 = conv(h1,h2,'same');

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by