Not Enough Input Arguments

조회 수: 3 (최근 30일)
Andrea Simpson
Andrea Simpson 2021년 4월 12일
댓글: Cris LaPierre 2021년 4월 18일
Hi, I'm very new to MATLAB and I am having some trouble. Could somebody please explain what this error is and how to fix it?
Its written
"convolution requires more input arguments to run:
convolution(x,h)
enter input arguments by typing them now, then press Enter to run. The values you enter will be set as the default inputs when you click the Run button in the future."
let say i want to input x = [1 2 3 4]; h = [1 -1 1 -1];
where should i put it?
function [ Y ] = convolution( x,h )
m=length(x);
n=length(h);
X=[x,zeros(1,n)];
H=[h,zeros(1,m)];
for i=1:n+m-1
Y(i)=0;
for j=1:m
if(i-j+1>0)
Y(i)=Y(i)+X(j)*H(i-j+1);
end
end
end
% using inbuilt command
yin = conv(x,h);
xaxis = 0:1:n+m-2;
subplot(2,1,1)
stem(xaxis,Y); xlabel('n value'); ylabel('y value'); title('Manual Convolution');
grid on;
subplot(2,1,2)
stem(xaxis,yin); xlabel('n value'); ylabel('y value'); title('Convolution using conv');
grid on;
end
  댓글 수: 2
Jonas
Jonas 2021년 4월 18일
i have no problems running this code, it just works. i'm running 2021b
i'm just typing
x = [1 2 3 4]; h = [1 -1 1 -1];
convolution(x,h)
in the command line.
It just looks like you try to run a function by clicking the Run button and then entering the values and something went wrong there.
Cris LaPierre
Cris LaPierre 2021년 4월 18일
*2021a

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2021년 4월 18일
"when you click the Run button in the future" - This means, that you tried to run the programn pressing the green triangle, the "Run button". Doing this does not define the inputs of a function. It is like instructing Matlab to run: sin() without providing inputs.
Type this in the command window:
x = [1 2 3 4];
h = [1 -1 1 -1];
Y = convolution( x,h )

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by