Hello manolis and christian, i've tried the function that you both gave but still wrong.
hz2mel = @ (hz) (1127*log(1+hz/700)); %Hertz to mel mel2hz = @ (mel) (700*exp(mel/1127)-700); %mel to Hertz f_low=300; f_high=8000; filt_num=12; fs=16000;
%% computing band in mel-scale mel_low=2595*log10(1+(f_low/100)); mel_high=2595*log10(1+(f_high/100));
%% creating the mel-scaled vector Mel = linspace(mel_low,mel_high,filt_num);
%% computing frequencies of the Mel vector Freq=700*((10.^(Mel/2595))-1); Freq=mel2hz(Mel);
Then i give the function that is explained by christian. like this : %% convert frequencies to nearest bins function H=formula(k,f,m) if k<f(m-1) H = 0; elseif (k>=f(m-1)&&k<=f(m)) H = (k-f(m-1))/(f(m)-f(m-1)); elseif (k>=f(m+1)&&k<=f(m)) H = (f(m+1)-k)/(f(m+1)-f(m)); elseif k>f(m+1) H = 0; end
After that I call the variable "Freq" to display on the plot. So the results I get like this.
Can you help me. thank you...