Filter löschen
Filter löschen

How can I create a quadratic matrix with variables?

3 Ansichten (letzte 30 Tage)
Edoardo Cioffi
Edoardo Cioffi am 7 Jul. 2022
Kommentiert: Karim am 7 Jul. 2022
I need to create the matrix of such that i get the matrix and so on? I need all the elements of the nxn matrix to be variables. I tried with :
syms q1dot q2dot q3dot q4dot q5dot;
qdot= [q1dot q2dot q3dot q4dot q5dot].'*[q1dot q2dot q3dot q4dot q5dot];
but it doesn't seem to work. Many thanks.

Antworten (2)

KSSV
KSSV am 7 Jul. 2022
syms q [1 5] real
iwant = q'*q
iwant = 
  1 Kommentar
Karim
Karim am 7 Jul. 2022
you were a bit faster than me :) nice approach using the [1 5]!

Melden Sie sich an, um zu kommentieren.


Karim
Karim am 7 Jul. 2022
you do not need to use .' in this case, only use the transpose operator:
syms q1dot q2dot q3dot q4dot q5dot real
qdot= [q1dot q2dot q3dot q4dot q5dot]' * [q1dot q2dot q3dot q4dot q5dot]
qdot = 

Kategorien

Mehr zu Quadratic Programming and Cone Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by