Question
Why do I receive an error "Undefined function 'cos' for input arguments of type 'int32'" in Signal Processing Toolbox 6.16 (R2011b)? I have written a function in MATLAB that uses the WINDOW function from the Signal Processing Toolbox (in this example, I call the WINDOW function with the BLACKMAN window type). Why do I receive an error? Reproduction steps: N = int32(2048); awin = window(@blackman,N) Resulting error message: Undefined function 'cos' for input arguments of type 'int32'. Error in gencoswin>calc_window (line 90) w = 0.42 - 0.5*cos(2*pi*x) + 0.08*cos(4*pi*x); Error in gencoswin>sym_window (line 59) w = calc_window(half,n,window); Error in gencoswin (line 46) w = sym_window(n,window); Error in blackman (line 17) [w,msg,msgobj] = gencoswin('blackman',varargin{:}); Error in window (line 54) w = feval(wname,N,varargin{:});
Expert Answer
Kshitij Singh
PhD Expert
Answered Aug 25, 2026
Workaround:
Recast the "N" parameter of WINDOW as a DOUBLE before calling the WINDOW function. Here is an example:
N = double(N); awin = window(@blackman,N);
Explanation:
The MATLAB function WINDOW has a parameter N that specifies the length of the generated window. This parameter must be of type "double" because it is later used in the COS function, which cannot operate on "integer" data types.
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →