Quaternions with symbolic elements

45 vues (au cours des 30 derniers jours)
Bandar
Bandar le 1 Fév 2022
Réponse apportée : Bruno Luong le 5 Nov 2024 à 12:19
I'm trying to create quaternion number that contains symbolic elements but Matlab throws an error.
syms a
d=quaternion(1,2,3,a)
This is the error I get
All inputs to the quaternion constructor must be the same class (double or
single).
  1 commentaire
James Tursa
James Tursa le 1 Fév 2022
Modifié(e) : James Tursa le 1 Fév 2022
What do you intend to do with these symbolic quaternions downstream in your code? It would be pretty easy to write your own basic functions such as add, subtract, multiply, conjugate, inverse, etc. But if you intend to convert them to other forms such as direction cosine matrix or Euler angles then you will run into major difficulties.

Connectez-vous pour commenter.

Réponse acceptée

Chris
Chris le 1 Fév 2022
The error says it all. It looks like symbolic variables aren't supported for quaternions. You might try a third-party toolbox:

Plus de réponses (1)

Bruno Luong
Bruno Luong le 5 Nov 2024 à 12:19
Work around is use 2 x 2 (symboloc) complex matrix to do quaternion computation https://en.wikipedia.org/wiki/Quaternion#Matrix_representations

Catégories

En savoir plus sur Coordinate Transformations dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by