Why it gives Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters

6 views (last 30 days)
h = fspecial('unsharp');
f = imfilter(f1,h);
fig_demo = decorrstretch(f,'tol',0.01);
J= imadjust(fig_demo, [0.05 0.75], []);
% J = imadjust(D1, [0.15 0.78], []);
[M, N] = size(J);
[J, revertclass] = tofloat(J);
PQ=paddedsize(size(J)); % f is floating point.
D0=0.5*PQ(1);
HBW = hpfilter('btw', PQ(1),PQ(2), D0,2);
%%hp filter function
function H = hpfilter(type,PQ(1); PQ(2), D0, n)
%HPFILTER Computes frequency domain highpass filters
% H = HPFILTER(TYPE, M, N, D0, n) creates the transfer function of
% a highpass filter, H, of the specified TYPE and size (M-by-N).
% Valid values for TYPE, D0, and n are:
%
% 'ideal' Ideal highpass filter with cutoff frequency D0. n
% need not be supplied. D0 must be positive
%
% 'btw' Butterworth highpass filter of order n, and cutoff D0.
% The default value for n is 1.0. D0 must be positive.
%
% 'gaussian' Gaussian highpass filter with cutoff (standard deviation)
% D0. n need not be supplied. D0 must be positive.
%
% The transfer function Hhp of a highpass filter is 1 - Hlp,
% where Hlp is the transfer function of the corresponding lowpass
% filter. Thus, we can use function lpfilter to generate highpass
% filters.
if nargin == 4
n = 1; % Default value of n.
end
% Generate highpass filter.
Hlp = lpfilter(type, M, N, D0, n);
H = 1 - Hlp;

Accepted Answer

Sindar
Sindar on 24 Feb 2020
This would be much easier to solve if you included the full error text. But, I suspect the problem is here:
function H = hpfilter(type,PQ(1); PQ(2), D0, n)
you have ; instead of ,
function H = hpfilter(type,PQ(1), PQ(2), D0, n)

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!