running it an error occurs as follows:??? Subscript indices must either be real positive integers or logicals. Error in ==> hanningwindow at 15 y(f)=20*log(abs(b));
4 views (last 30 days)
Show older comments
clear all;
clc;
N=input('enter the value of N=')
n = 0:N-1;
b = 0.5*(1 - cos(2*pi*n/(N-1)));
plot(n,b)
xlabel('time samples')
ylabel('amplitude')
figure
f=0:N-1;
fmax=max(f);
m=f/fmax;
y(f)=20*log(abs(b));
plot(m,y)
xlabel('normalized frequency')
ylabel('magnitude')
0 Comments
Accepted Answer
Azzi Abdelmalek
on 4 Aug 2013
Edited: Azzi Abdelmalek
on 4 Aug 2013
The error is in this line
y(f)=20*log(abs(b));
It should be
y=20*log(abs(b));
Also avoid using clear all, use just clear
More Answers (0)
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!