call mupad's subsex from matlab, theta substitution problem.
Show older comments
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
Answers (1)
Andrew Newell
on 30 May 2011
0 votes
theta is a function in MuPAD. Since it's case-sensitive, you could use Theta.
Categories
Find more on Library Domains 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!