Too many input arguments for function not called in live script
2 次查看(过去 30 天)
显示 更早的评论
Hello
I am trying to use a windowing function and I am using a live script. I have the various window function handles as a drop down and I am generating windows based on the drop down value.
% Various Orders of FIR
min_ord = 3; % This is a slider
max_ord = 5; % This is a slider
cutoff = 75; % This is a slider
options = [];
windowf = @chebwin; %This is a drop down
% These three windows require an input
if isequal(windowf, @kaiser)
options = 0.5; % Beta value
elseif isequal(windowf, @chebwin)
options = 50; % Sideband Attenuation in dB
elseif isequal(windowf, @tukeywin)
options = 0.44; % Ratio of taper to constant section
end
h_arr = []; wh_arr = [];
out_arr = [];
gp_arr = []; wgp_arr = [];
for i = min_ord:1:max_ord
windowvals = [];
if isempty(options)
windowvals = window(windowf, i+1)
else
windowvals = window(windowf, i+1, options);
end
b = fir1(i, cutoff/(fs/2), "low", windowvals);
...
Now when I run this code, I am getting the following error
Error using barthannwin (line 24)
Too many input arguments.
This happens even if the selected window is not Bartlett-Hann. I have even tried to remove Bartlett-Hann from the drop down options and I am still gettting the same error. I am not sure how to fix this. Is there a workaround?
0 个评论
回答(1 个)
Mahesh Taparia
2021-2-22
Hi
I replicate your code, its working in my case. You have not defined the variable fs, also did not put end after for loop. For your 2nd query, try to clear the variable and again run the code. It will work.
Hope it will help!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!