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!