How to Implement equationsToMatrix command
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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]';
wr=cos(br)*cos(pr)*i+sin(br)*cos(pr)*j+sin(pr)*k
ws=cos(bs)*cos(ps)*i+sin(bs)*cos(ps)*j+sin(ps)*k
wt=cos(bt)*cos(pt)*i+sin(bt)*cos(pt)*j+sin(pt)*k
Pr=POr+mr*wr
Ps=POs+ms*ws
Pt=POt+mt*wt
f=norm(Pr-Ps)^2-b1^2
g=norm(Ps-Pt)^2-b2^2
h=norm(Pt-Pr)^2-b1^2
[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)
f=(Pr-Ps)^2-b1^2
How can I find the expressions in equation in 7a, 7b,7c and A1 A2 A3 ?
Thanks in advance.
0 comentarios
Respuestas (1)
Walter Roberson
el 26 de Feb. de 2021
f=(Pr-Ps).^2-b1^2
2 comentarios
Walter Roberson
el 26 de Feb. de 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.
Ver también
Categorías
Más información sobre Formula Manipulation and Simplification en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!