필터 지우기
필터 지우기

someone who can tell me my mistake why it doesn't graph me?????? QUESTION 14.

조회 수: 1 (최근 30일)
Miguel Amor Rodriguez Avelino
Miguel Amor Rodriguez Avelino 2022년 4월 29일
댓글: Voss 2022년 5월 31일
P0214: Use function 'conv(h,x)' to compute noncausal
% h convolves causal x
close all; clc
nh = -4:4;
nx = 0:5;
h = ones(1,9);
x = 1:6;
y1 = conv(h,x); % compute convolution
s= (nh(1)+nx(1)):(nh(end)+nx(end)); % define support
m = conv0(h,nh,x,nx); % verification
%plot
plot(x,y1)

답변 (1개)

Voss
Voss 2022년 4월 29일
Maybe the plot command is never reached because of an error on the previous line:
try
% h convolves causal x
close all; clc
nh = -4:4;
nx = 0:5;
h = ones(1,9);
x = 1:6;
y1 = conv(h,x); % compute convolution
s= (nh(1)+nx(1)):(nh(end)+nx(end)); % define support
m = conv0(h,nh,x,nx); % verification
%plot
plot(x,y1)
catch ME
disp(ME.message);
end % see error message below:
Undefined function 'conv0' for input arguments of type 'double'.
Or maybe you do have a function called conv0 that runs ok, but then calling plot gives an error because x and y1 are of different lengths:
try
% h convolves causal x
close all; clc
nh = -4:4;
nx = 0:5;
h = ones(1,9);
x = 1:6;
y1 = conv(h,x); % compute convolution
s= (nh(1)+nx(1)):(nh(end)+nx(end)); % define support
% m = conv0(h,nh,x,nx); % verification
%plot
plot(x,y1)
catch ME
disp(ME.message);
end % see error message below:
Vectors must be the same length.
Check the command window for error messages.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by