Matlab says function 'kroneckerDelta' is undefined

Asked 1 years ago, Updated 1 years ago, 112 views

The following bandstop filters are programmed by on matlab.

% Design FIR Filter by Window Function Method
wp = 0.2*pi; ws = 0.4*pi; % pass area end frequency, element area end frequency
w1 = 0.2 * pi; w2 = 0.4 * pi;
w0 = (w1+w2)/2;
trwidth = ws-wp;% transition bandwidth
N=ceil (6.6*pi/trwidth) + 1% Hamming window length (tap length)
win=hamming(N);% Hamming Window
Design FIR Filter with % Window Function (Unit Impulse Response)
wc = (w2-w1)/2;% cut-off frequency
n=-(N-1)/2—(N-1)/2;% time range
h=(2*kroneckerDelta(n))-(diag(2*cos(n*w0))*transpose((wc/pi)*inc(n*wc/pi)));% designed unit impulse response
subplot(2,2,1); 
stem(n,h);% Impulse Response Illustrated
axis([-(N-1)/2(N-1)/2-0.10.3]); grid;
xlabel('Time n');ylabel('g(n)');% Designed FIR Filter Frequency Response
dw = 0.001; % frequency increment
w=-20*pi:dw:20*pi;% frequency range
H = freqz(h,1,w);
maxH = max(abs(H)); % Max Frequency Response
dBH = 20*log10(abs(H)/maxH); normalization of % amplitude characteristics
subplot(2,2,2);
plot(w, dBH);% Amplitude Characteristics Illustrated
axis([-4*pi4*pi-805]); grid;
xlabel('Frequency\omega[rad]'); ylabel('|H(e^{j\omega})|[dB]');
Check Rp=-min(dBH(1:ceil(wp/dw)+1)% pass area ripple
Verify As=-max(dBH(ceil(ws/dw)+1:length(w)))% containment attenuation

However, the following error occurred, and
required to form the unit impulse response of the band stop filter. The Kronecker delta function cannot be output. (We know that Kronecker's delta function will be synchronized with n to output 2.)

 The function 'kroneckerDelta' is undefined.

Error: matlab_bandstopFIR(line11)
h=(kroneckerDelta(n))-(diag(2*cos(n*w0))*transpose((wc/pi)*inc(n*wc/pi)));% designed unit impulse response

Therefore, I am very sorry to trouble you, but if anyone knows, I would be very grateful if you could let me know.
Thank you for your cooperation.

matlab

2022-09-30 21:17

1 Answers

First, since the kroneckerDelta function seems to be included in the Symbolic Math Toolbox,
Verify that this toolbox is installed.


2022-09-30 21:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.