Error using subs function of Symbolic Math toolbox
Show older comments
I am using the following code to generate data to use in Non linear Least Square Estimation
syms a b S
f=@(a,b,S) a+a*b + b*S;
Data =[ ];
for i = 1:10
Data =[Data ; [i, subs(f, [a,b,S], [1,2,i])] ];
end
When I run these I get the following error.
Expected input number 1, S, to be one of
these types:
sym
Instead its type was function_handle.
Error in sym/subs (line 60)
validateattributes(F, {'sym'}, {}, 'subs','S', 1);
I don't understand which at which part I'm making mistake. I even tried by converting sym before using subs but this sill doesn't seem to work.
My MATLAB version is 2019b
1 Comment
Torsten
on 29 Dec 2021
Use f = a+a*b+b*S instead of f=@(a,b,S) a+a*b+b*S.
Accepted Answer
More Answers (0)
Categories
Find more on Conversion Between Symbolic and Numeric in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
