Create a row vector

403 Ansichten (letzte 30 Tage)
Francis Adams Kwofie
Francis Adams Kwofie am 24 Jun. 2021
Kommentiert: Nate am 9 Sep. 2025 um 18:26
Create a row vector named x that starts at 1, ends at 10, and contains 5 elements.
  3 Kommentare
Image Analyst
Image Analyst am 23 Jan. 2023
@Balanarayanan This looks like a homework problem. If you have any questions ask your instructor or read the link below to get started:
Obviously we can't give you the full solution because you're not allowed to turn in our code as your own, but it will involve linspace and the ' (apostrophe) symbol.
Walter Roberson
Walter Roberson am 16 Okt. 2024
Carter comments to Image Analyst:
Real Homies would help

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

DGM
DGM am 24 Jun. 2021
Bearbeitet: DGM am 24 Jun. 2021
one way:
x = 1:2.25:10
x = 1×5
1.0000 3.2500 5.5000 7.7500 10.0000
another way
x = linspace(1,10,5)
x = 1×5
1.0000 3.2500 5.5000 7.7500 10.0000
of course, nothing says the vector had to be linear:
x = logspace(0,1,5)
x = 1×5
1.0000 1.7783 3.1623 5.6234 10.0000
or monotonically increasing
x = [1 500 -pi sqrt(2) 10]
x = 1×5
1.0000 500.0000 -3.1416 1.4142 10.0000
  1 Kommentar
Nate
Nate vor etwa 4 Stunden
you a real homie

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Image Analyst
Image Analyst am 24 Jun. 2021
You learn these basics in the first half hour of the intro MATLAB course. Evidently you need to take this:
  3 Kommentare
Image Analyst
Image Analyst am 23 Jan. 2023
Voss
Voss am 16 Okt. 2024
The transpose operator is .'
' is the complex conjugate transpose operator.

Melden Sie sich an, um zu kommentieren.


Meghana
Meghana am 28 Aug. 2024
Create a row vector that has the following elements: , , , , 129, and .
  1 Kommentar
DGM
DGM am 28 Aug. 2024
Bearbeitet: DGM am 28 Aug. 2024
Oh that's easy
a = 129
a = 129
Note that a scalar is both a row vector and a column vector. It's also a matrix.
% yes, it's a row vector
[isscalar(a) isvector(a) isrow(a) iscolumn(a) ismatrix(a)]
ans = 1x5 logical array
1 1 1 1 1
You probably didn't want that, but you never bothered to actually check to see if what you copy-pasted actually worked.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating and Concatenating Matrices 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