MATLAB Answers

How to Implement equationsToMatrix command

9 views (last 30 days)
ercan duzgun
ercan duzgun on 26 Feb 2021
Commented: Walter Roberson on 26 Feb 2021
From the paper of "Direct Displacement Analysis of a Stewart Platform Mechanism (Der-Ming Ku, 1997)", I am trying to check the equations in the paper symbolically.
The equations as follows:
My code in MATLAB is as follows:
clear all;close all;clc;
syms br pr bs ps bt pt
syms b1 b2 b3 mr ms mt real positive
syms POrx POry POrz real
syms POsx POsy POsz real
syms POtx POty POtz real
POr=[POrx POry POrz]';
POs=[POsx POsy POsz]';
POt=[POtx POty POtz]';
i=[1 0 0]';j=[0 1 0]';k=[0 0 1]';
[A,b] = equationsToMatrix([f;g;h],[pr,ps,pt])
I receive error if I run the code. The error I receive is this:
Error using symengine
Not a square matrix.
Error in sym/privBinaryOp (line 1032)
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
Error in ^ (line 332)
B = privBinaryOp(A, p, 'symobj::mpower');
Error in Program1_sembolik (line 23)
How can I find the expressions in equation in 7a, 7b,7c and A1 A2 A3 ?
Thanks in advance.

Answers (1)

Walter Roberson
Walter Roberson on 26 Feb 2021
Walter Roberson
Walter Roberson on 26 Feb 2021
You cannot solve that. EquationsToMatrix is trying to separate out the set of expressions into the form Matrix*(vars.') + Residue, which can only be done for linear equations, but your system is not linear.
What you can do is create new variables like COSpr SINpr and subs() those in for cos(pr) and sin(pr), getting [f;g;h] that is linear in those variables. You could also subs(EXPRESSION, sin(pr), sqrt(1-COSpr)^2) to reduce the variables, but if you do that then you risk losing the proper sign unless you take extra care to introduce an extra variable to hold the sign.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!