I am getting an error "not enough input arguments" even though i have given command [a,b]=my_conv[[1 2 -1 4 3 -2] ,[-1 0 4 3 1] , 2, 2] for the function given below, HELP me

1 回表示 (過去 30 日間)
function [y,yz]=my_conv(x1,x2,z1,z2)
%output zero
yz=-(-z1+1-z2+1)+1;
%output length
ylen=length(x1)+length(x2)-1;
y=zeros(ylen);
x11=[x1,zeros(length(x2))];
x22=[x2,zeros(length(x1))];
for i=1:ylen
for j=1:i
y(i)=y(i)+x11(j)*x22(i-j+1);
end
end
end
  3 件のコメント
Akash Reddy KANKANALA
Akash Reddy KANKANALA 2021 年 9 月 8 日
is there anything wrong with my function?
Rik
Rik 2021 年 9 月 9 日
Did you try running it yourself? Then you will ge the same error.
You could check the edits Chien made in his answer.

サインインしてコメントする。

採用された回答

Chien Poon
Chien Poon 2021 年 9 月 8 日
% [a,b]=my_conv([1 2 -1 4 3 -2] ,[-1 0 4 3 1], 2, 2)
function [y,yz]=my_conv(x1,x2,z1,z2)
%output zero
yz=-(-z1+1-z2+1)+1;
%output length
ylen=length(x1)+length(x2)-1;
y=zeros(1,ylen);
x11=[x1,zeros(1,length(x2))];
x22=[x2,zeros(1,length(x1))];
for i=1:ylen
for j=1:i
y(i)=y(i)+x11(j)*x22(i-j+1);
end
end
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by