someone who can tell me my mistake why it doesn't graph me?????? QUESTION 14.
2 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
回答(1 个)
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:
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:
Check the command window for error messages.
2 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!