Usually I am using the following 3 lines for plotting filter frequency
response;
[H F]=freqz(x, [1], 2^10, Fs);
Mag = 20*log10(abs(H));
plot(F, Mag);
So, I tried to put them in a single Matlab function instead of declaring all of
them each time in the scripts, but when I am using it as a function I got this
error
??? Subscript indices must either be real positive integers or logicals.
Here it is the function;
-------------------------------
function plot_freq_response(x, Fs)
[H F]=freqz(x, [1], 2^10, Fs);
Mag = 20*log10(abs(H));
plot(F, Mag);
Thanks in advance.
Ahmed.
Frequency response plotting
Started by ●August 26, 2007
Reply by ●August 27, 20072007-08-27
Dear Ahmed
Write a simple test program with only value of x and Fs. Call your *
plot_freq_response(x,Fs)* function from that program.
Check whether it is ok or not?
Actually along with the error u might be getting some line number . In that
line number check whether the indices you are using to index into the matrix
are either positve integers or logical 0.?
With Best Regards
Prajit S Niar
On 8/25/07, Ahmed Shahein wrote:
>
> Usually I am using the following 3 lines for plotting filter frequency
> response;
>
> [H F]=freqz(x, [1], 2^10, Fs);
>
> Mag = 20*log10(abs(H));
>
> plot(F, Mag);
>
> So, I tried to put them in a single Matlab function instead of declaring
> all of them each time in the scripts, but when I am using it as a function I
> got this error
>
> ??? Subscript indices must either be real positive integers or logicals.
>
> Here it is the function;
> -------------------------------
> function plot_freq_response(x, Fs)
>
> [H F]=freqz(x, [1], 2^10, Fs);
>
> Mag = 20*log10(abs(H));
>
> plot(F, Mag);
>
> Thanks in advance.
>
> Ahmed.
>
Write a simple test program with only value of x and Fs. Call your *
plot_freq_response(x,Fs)* function from that program.
Check whether it is ok or not?
Actually along with the error u might be getting some line number . In that
line number check whether the indices you are using to index into the matrix
are either positve integers or logical 0.?
With Best Regards
Prajit S Niar
On 8/25/07, Ahmed Shahein wrote:
>
> Usually I am using the following 3 lines for plotting filter frequency
> response;
>
> [H F]=freqz(x, [1], 2^10, Fs);
>
> Mag = 20*log10(abs(H));
>
> plot(F, Mag);
>
> So, I tried to put them in a single Matlab function instead of declaring
> all of them each time in the scripts, but when I am using it as a function I
> got this error
>
> ??? Subscript indices must either be real positive integers or logicals.
>
> Here it is the function;
> -------------------------------
> function plot_freq_response(x, Fs)
>
> [H F]=freqz(x, [1], 2^10, Fs);
>
> Mag = 20*log10(abs(H));
>
> plot(F, Mag);
>
> Thanks in advance.
>
> Ahmed.
>
Reply by ●August 27, 20072007-08-27
Hi,
What are your inputs for Fs and x?
Regards,
Nik.
Usually I am using the following 3 lines for plotting filter frequency response;
>
>[H F]=freqz(x, [1], 2^10, Fs);
>
>Mag = 20*log10(abs(H));
>
>plot(F, Mag);
>
>So, I tried to put them in a single Matlab function instead of declaring all of them each time in the scripts, but when I am using it as a function I got this error
>
>??? Subscript indices must either be real positive integers or logicals.
>
>Here it is the function;
>-------------------------------
>function plot_freq_response(x, Fs)
>
>[H F]=freqz(x, [1], 2^10, Fs);
>
>Mag = 20*log10(abs(H));
>
>plot(F, Mag);
>
>Thanks in advance.
>
>Ahmed.
What are your inputs for Fs and x?
Regards,
Nik.
Usually I am using the following 3 lines for plotting filter frequency response;
>
>[H F]=freqz(x, [1], 2^10, Fs);
>
>Mag = 20*log10(abs(H));
>
>plot(F, Mag);
>
>So, I tried to put them in a single Matlab function instead of declaring all of them each time in the scripts, but when I am using it as a function I got this error
>
>??? Subscript indices must either be real positive integers or logicals.
>
>Here it is the function;
>-------------------------------
>function plot_freq_response(x, Fs)
>
>[H F]=freqz(x, [1], 2^10, Fs);
>
>Mag = 20*log10(abs(H));
>
>plot(F, Mag);
>
>Thanks in advance.
>
>Ahmed.