Creating vectors with components

4 visualizzazioni (ultimi 30 giorni)
Manasa Tarigoppula
Manasa Tarigoppula il 21 Set 2019
Risposto: Bruno Luong il 21 Set 2019
How do I create a 5-element column vector whose components are the squares of the elements of vector Row
  2 Commenti
David Hill
David Hill il 21 Set 2019
Look at transpose and basic matrix operations
Walter Roberson
Walter Roberson il 21 Set 2019
What do you want to do if the vector Row is not exactly 5 elements long ?

Accedi per commentare.

Risposte (1)

Bruno Luong
Bruno Luong il 21 Set 2019
r=[3 2 7 5 2]
r(1:min(5,end)).^2.'
or
r(1:min(5,end)).'.^2

Categorie

Scopri di più su Shifting and Sorting Matrices in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by