call mupad's subsex from matlab, theta substitution problem.
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Andrew Newell
2011-5-30
theta is a function in MuPAD. Since it's case-sensitive, you could use Theta.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!