error using matlabFunction : 'Error: argument must be of type 'Type:arithmetical' [cos]
Mostrar comentarios más antiguos
I am attempting to write a symbolic matrix to a function using 'matlabFunction':
Here is my code, M_c is a 9x9 symbolic matrix: f = matlabFunction(M_c,'file','cluster_mass_eval')
This is the error I get:
??? Error using ==> mupadengine.mupadengine>mupadengine.feval at 162 Error: argument must be of type 'Type::Arithmetical' [cos]
Error in ==> sym.matlabFunction>optimize at 392 list = feval(symengine,'mlOptimizeWithIntermediates',f);
Error in ==> sym.matlabFunction>writeMATLAB at 367 [f,temps] = optimize(f);
Error in ==> sym.matlabFunction at 117 g = writeMATLAB(funs,file,varnames,outputs,body);
Is this saying that I can't have trigonometric functions of symbolic variables?
I am searching for the best way to be able to evaluate this symbolic matrix in a loop so if 'matlabFunction' isn't the best thing to use i welcome other suggestions.
Thanks, kyle
3 comentarios
Kyle Stanhouse
el 10 de Ag. de 2011
Walter Roberson
el 10 de Ag. de 2011
f = matlabFunction(M_c,'file','cluster_mass_eval','vars',{'theta', 'beta', 'p', 'q'})
Kyle Stanhouse
el 10 de Ag. de 2011
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 11 de Ag. de 2011
0 votos
Do not use eval() on a symbolic value to try to substitute specific values for variables. Instead, use subs(), possibly followed by double()
1 comentario
Kyle Stanhouse
el 12 de Ag. de 2011
Categorías
Más información sobre Operations on Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!