Error: Function definition not supported in this context. Create functions in code file.
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
m=80; % The length of the Karnel%
n=0:1:m-1; %Defines Range of position value%
p=n-(m-1)/2; %Angle%
fc=0.1; %Define Cutoff frequency%
Z=sin(2*pi*fc*p)./(pi*p); %Define truncated Sinc
function%
stem(n,Z);grid %To represent the discrete signal value &
draw the grid lines%
title('Unit Sample Response of the sin function') %Define
the title of the figure%
xlabel('n') %Define the label of on x axis%
ylabel('Z') %Define the label of on y axis%
figure; %To draw a figure%
[h,w]=freqz(Z); %get Frequency Response%
plot(w/pi,abs(h));grid
title('Frequency response of the sin function')
xlabel('Frequency')
ylabel('Amplitude')
figure;
s=2*pi*(n/(m-1)); %Angle%
w=0.54-0.46*cos(s); %Define Hamming window function%
stem(n,w);grid
title('Hamming Window')
xlabel('n')
ylabel('w')
figure;
t=Z.*w; %Multiplication of Hamming Window and sin
function%
stem(n,t);grid
title('Multiplication of Hamming Window and sin function')
xlabel('n')
ylabel('t')
figure;
[h,w]=freqz(t);
plot(w/pi,abs(h));grid
xlabel('Frequency')
ylabel('Magnitude')
title('Frequency response of the windowed sin function')
figure;grid
freqz(t)
title('Frequency Response of the windowed sin function in dB')
0 Kommentare
Antworten (1)
Alan Stevens
am 14 Jan. 2021
You need to turn
Z=sin(2*pi*fc*p)./(pi*p); %Define truncated Sinc
function%
into
Z=sin(2*pi*fc*p)./(pi*p); %Define truncated Sinc function
2 Kommentare
Alan Stevens
am 14 Jan. 2021
Change
stem(n,Z);grid %To represent the discrete signal value &
draw the grid lines%
to
stem(n,Z);grid %To represent the discrete signal value & draw the grid lines%
Make sure any comments follow the % symbol and don't precede them.
Siehe auch
Kategorien
Mehr zu Hamming finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!