I have a matched filter, which I want to plot its frequency response in Matlab.
The filter response is: H(f) =
I tried to to plot it with:
%Freqency_Response_of_wiener_filter
f = linspace(-1e3,1e3,1e5);
H = ((2*pi*f)^2+10^6)/(11*(2*pi*f)^2+10^6+10^4);
plot(f,H);
xlabel('f')
ylabel('H(f)')
which not working, giving me error of 'Matrix dimensions must agree' kind.
I then read about 'element-wise power', which seems to fit exactly to what I need, and changed H
to:
H = ((2*pi*f).^2+10^6)/(11*(2*pi*f).^2+10^6+10^4);
This indeed plot something, just not what I want :) I tried also
H = ((2*pi)^2*f.^2+10^6)/(11*(2*pi)^2*f.^2+10^6+10^4);
with no luck. The only way I got it working is:
%Freqency_Response_of_wiener_filter
f = linspace(-1e3,1e3,1e5);
for i=1:length(f)
H(i) = ((2*pi*f(i))^2+10^6)/(11*(2*pi*f(i))^2+10^6+10^4);
end
plot(f,H);
Why is 'element-wise power' not working for me?
More than that - what exactly the differenece between regular operation to 'element-wise operation'? Because, for example, over here: An Introduction to Matlab, there's this plot:
a = 0:.01:5;
b = cos(2*pi*a);
plot(a,b)
and then this one:
x = 2:.1:4;
y = 1./x;
plot(x,y)
xlabel('x');
ylabel('y');
and I can't tell any difference between them. Why on the first one there was no need of 'element-wise operation', while in the second one there was?
Thanks.