- In a function file which contains only function definitions. The name of the file must match the name of the first function in the file.
>> untitled Not enough input arguments. Error in untitled (line 10) y = (n - k) >= 0;
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
function y = stepseq(n, k)
% Generates a unit step sequence u[n-k]
% n: range of sequence
% k: offset (default is 0)
if nargin < 2
k = 0;
end
y = (n - k) >= 0;
N = 20;
% Define impulse response h[n]
n = 0:N-1;
h = (0.5.^n).*(stepseq(n,2) - stepseq(n,6));
% Define input x[n]
x = 2*(stepseq(n,-5) - stepseq(n,2));
% Compute output y[n]
y = conv(x,h);
% Plot output sequence y[n]
stem(0:N-1, y(1:N))
xlabel('n')
ylabel('y[n]')
title('Output of the system')
It shows:
>> untitled
Not enough input arguments.
Error in untitled (line 10)
y = (n - k) >= 0;
0 comentarios
Respuestas (1)
Cris LaPierre
el 14 de Mzo. de 2023
You need to call your function by name. Your file and your function should share the same name. So your syntax should be
stepseq(n, k)
0 comentarios
Ver también
Categorías
Más información sobre Digital Filter Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!