Problem with using symbolic expersion in function toeplitz

I'm having some problems with the toeplitz function when using symbolic variables
syms a b c
toeplitz([a b c], [1 b/2 a/2])
I get the following error
Error using toeplitz (line 22)
Inputs must be numeric.
I'm using Matlab 2019b, I don't think this is a bug since when I open Matlab "toeplitz" function, it has that error call
Thanks in advance

1 Comment

update: I check the same function in Matlab 2019a and it worked. However I would like to find a workaround for the 2019b.

Sign in to comment.

 Accepted Answer

Might be a bug. I didn’t have any problems with 2020a either. It’s better if you make a big report.

5 Comments

I create my own toepliz function. Which is basically the same that Matlab had I only commented the isnumeric condition.
That's why I was a bit reluctant to report it as a bug since in the Matlab function this condition appears.
function t = toeplitzPaco(c,r)
%TOEPLITZ Toeplitz matrix.
% TOEPLITZ(C,R) is a non-symmetric Toeplitz matrix having C as its
% first column and R as its first row.
%
% TOEPLITZ(R) is a symmetric Toeplitz matrix for real R.
% For a complex vector R with a real first element, T = toeplitz(r)
% returns the Hermitian Toeplitz matrix formed from R. When the
% first element of R is not real, the resulting matrix is Hermitian
% off the main diagonal, i.e., T_{i,j} = conj(T_{j,i}) for i ~= j.
%
% Class support for inputs C,R:
% float: double, single
% integer: uint8, int8, uint16, int16, uint32, int32, uint64, int64
%
% See also HANKEL.
% Thanks to A.K. Booer for the original version.
% Copyright 1984-2017 The MathWorks, Inc.
%if ~(isnumeric(c) && (nargin < 2 || isnumeric(r)))
% error(message('MATLAB:toeplitz:nonNumericInputs'));
%end
if nargin < 2
c(1) = conj(c(1)); % set up for Hermitian Toeplitz
r = c;
c = conj(c);
else
if ~isempty(c) && ~isempty(r) && ~isequaln(r(1),c(1))
warning(message('MATLAB:toeplitz:DiagonalConflict'))
end
end
r = r(:); % force column structure
c = c(:);
p = length(r);
m = length(c);
x = [r(p:-1:2, 1) ; c]; % build vector of user data
ij = (0:m-1)' + (p:-1:1); % Toeplitz subscripts
t = x(ij); % actual data
if isrow(ij) && ~isempty(t) % preserve shape for a single row
t = t.';
end
This is one of the reasons that you SHOULD NOT name a function as same as the inbuilt function!
what? I didn't, I KNOW that. Check the name of the function toepliztPaco (that's my function). I just went inside the MAtlab toeplitz function copied and created my own function and commented the isnumeric condition.
As I MENTIONED in my last comment.
Update
toeplizt function can indeed take symbolic in Matlab 2019b. The problem I had was that I installed Maple and click on "link to Matlab" option. This option uses Maple symbolic solver and affects other Matlab functions.
I uninstalled Maple and then everything worked as it should. No need to create my own toeplitz function

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!