How to determine the size of an array of functions??
Afficher commentaires plus anciens
F = @(x1,x2) [(4*x1^2-20*x1+x2^2/4+8) ; (x1*x2/2+2*x1-5*x2+8)]
J = @(x1,x2) [(8*x1-20) (x2/2) ; (x2/2+2) (x1/5-5)]
x0 = [ 1 2 3 4 ];
tol = 10^-5;
A = nargin(F);
B = nargin(J);
I would like to find the size of F & J because i will use those as inputs to my function and they will not be known. Something like:
[C D]=size(F)
[G H]=size(J)
would be excellent if it worked. At first I thought matlab didn't like doing the anonymous matrix thing I'm trying, but it evaluates the functions just fine if given an input like:
F(0,0)
will output:
[8 ; 8]
as it should.
So i tried evaluating the functions with 'A' and 'B' number of zeros, but didn't have much luck in figuring that out as an array is not what the functions input.
Any help would be greatly appreciated!
3 commentaires
Guillaume
le 27 Nov 2017
What do you call the size of a function? Are you talking about the size of the output of the function?
Doesn't that depend on the size of inputs?
Timothy Corley
le 27 Nov 2017
Timothy Corley
le 27 Nov 2017
Modifié(e) : Timothy Corley
le 27 Nov 2017
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Type Identification dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!