Hello!This is my code.
syms x;
m = 5; h = 2*pi*x; q= besseli(5,h); k1 = h.^2-q; k = [m*q.*(h-3).*5 0 ; 0 q.*h-2 ]
a = det(k) pretty(diff(k(x)),x) Then,I got this message:
Invalid indexing or function definition. When defining a function, ensure that the body of the function is a SYM object. When indexing, the input must be numeric, logical or ':'.
What does it mean?
Thanks!

 Réponse acceptée

Star Strider
Star Strider le 4 Mai 2014
Modifié(e) : Star Strider le 4 Mai 2014

1 vote

You haven’t declared k as a function of x previously, so the Symbolic Math Toolbox assumes x is a subscript (that actually makes sense considering that k is a matrix).
Do this instead:
syms x;
m = 5;
h = 2*pi*x;
q= besseli(5,h);
k1 = h.^2-q;
k = [m*q.*(h-3).*5 0 ; 0 q.*h-2 ]
a = det(k)
fprintf('\n\ndiff(k,x) = \n\n') % This makes the output easier to read
pretty(diff(k,x)) % <== Changed line
produces:
diff(k,x) =
/ pi besseli(5, 2 pi x) 50 + #1 (2 pi x - 3) 25, 0 \
| |
\ 0, pi besseli(5, 2 pi x) 2 + pi x #1 2 /
where
besseli(5, 2 pi x) 5
#1 == pi besseli(4, 2 pi x) 2 - --------------------
x

Plus de réponses (0)

Catégories

En savoir plus sur Simulink dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by