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

조회 수: 2 (최근 30일)
Bob Gray
Bob Gray 2011년 5월 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

답변 (1개)

Andrew Newell
Andrew Newell 2011년 5월 30일
theta is a function in MuPAD. Since it's case-sensitive, you could use Theta.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by