so I have the following code for an all-pass FIR filter in matlab, I have a couple of quesitons.
Firstly is the way I convolute the two together correct? The resulting signal is a few samples longer than the original.
Secondly how would I go about getting a magnitude vs. phase diagram like this one? from the coefficients I have already?
%% Initialise
clear all
close all
N=256;% filter tap length
Fs = 44100; %# Samples per second
toneFreq = 50; %# Tone frequency, in Hertz
nSeconds = 2; %# Duration of the sound
y = sin(linspace(0, nSeconds*toneFreq*2*pi, round(nSeconds*Fs)));
rng(1, 'twister');%
a=pi/2;
b=-a;
%% method
A = ones(N,1);%magnitude response set to 1
B = (b-a).*rand(N,1) + a;% random phase
hf=A.*(cos(B)+1j*sin(B)); %create coefficients
hn=ifft(hf); %convert to time domain
final=conv(hn,input); %filter?