Borrar filtros
Borrar filtros

call mupad's subsex from matlab, theta substitution problem.

1 visualización (últimos 30 días)
Bob Gray
Bob Gray el 30 de Mayo de 2011
I have a symbolic expression in terms of rho, cos(theta) and sin(theta). I want to replace all occurances of rho*cos(theta) with x and all rho*sin(theta) with y. I want to do this in a Matlab function m file.
I have in the m file, as an example: evalin(symengine,'subsex(expand(2*rho^2*sin(2*theta1)), rho*sin(theta1) = y)')
which works. But note that this has theta1 not theta. If I change theta1 to theta it fails. That is, this fails evalin(symengine,'subsex(expand(2*rho^2*sin(2*theta)), rho*sin(theta) = y)')
The error is:
??? Error using ==> mupadengine.mupadengine>mupadengine.evalin at 102 Error: argument must be of 'Type::Arithmetical' [sin]
Yes, I have syms x y rho theta theta1 hld;
as the first line in the m file. So what is different about using theta versus theta1?
Cheers, Bob Gray

Respuestas (1)

Andrew Newell
Andrew Newell el 30 de Mayo de 2011
theta is a function in MuPAD. Since it's case-sensitive, you could use Theta.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by