What does x(1,:) do in MATLAB ?

84 vues (au cours des 30 derniers jours)
JIIT Bainwala
JIIT Bainwala le 11 Mai 2012
Commenté : Steven Lord le 10 Juin 2024
What does x(1,:) do in MATLAB ?
eg:
at = sqrt(Po)*exp(-0.5*(1+i*C)*(tau./t0).^(2*m))
a0 = fft(at(1,:));
what does at(1,:) do here ?
  2 commentaires
Anil Chowdary Tummala
Anil Chowdary Tummala le 21 Avr 2021
Q1. What does x(1,:) do in MATLAB ?
Answer : It gives the first row of matrix 'x'
Q2. what does at(1,:) do here ?
Answer : it gives the first row of FFT coefficients of matrix 'at'
Anil Chowdary Tummala
Anil Chowdary Tummala le 10 Oct 2022
Thank you very much

Connectez-vous pour commenter.

Réponse acceptée

Dr. Seis
Dr. Seis le 11 Mai 2012
"a0" is the Fourier Transform of the first row of "at"
at(2,:) % gives the second row
at(3,:) % gives the third row (and so on)
at(:,1) % gives the first column (and so on)
  1 commentaire
JIIT Bainwala
JIIT Bainwala le 11 Mai 2012
thnx!

Connectez-vous pour commenter.

Plus de réponses (3)

Afissou ZONGO
Afissou ZONGO le 17 Août 2021
X(i*2,:) means
  1 commentaire
Walter Roberson
Walter Roberson le 17 Août 2021

Take the current value of the variable i and multiply it by 2. Use the result as row indices to select entire rows of X.

The code shown does not require that i is a scalar or even a vector. It also does not require that the values in i are currently integer values, but if they are not then there is the risk that there could be an indexing error.

There are uncommon cases in which i would not necessarily have to be numeric, but you might never see that happen in practice.

Connectez-vous pour commenter.


Sorabh Mahajan
Sorabh Mahajan le 27 Fév 2022
x = [x;i] meaining
  1 commentaire
Walter Roberson
Walter Roberson le 28 Fév 2022
[A;B] is defined as being vertcat(A, B) which in turn is defined as being the same as cat(2,A,B)
That is, [x;i] takes the existing array x, and tries to place a new row containing i at the bottom of it. With the x= assignment that becomes the new x. The effect is to add the content of i to the bottom of x.

Connectez-vous pour commenter.


Antonio
Antonio le 10 Juin 2024
x(1:2,1)? meaning
  1 commentaire
Steven Lord
Steven Lord le 10 Juin 2024
This performs "Indexing with Element Positions". In particular, "You can also reference multiple elements at a time by specifying their indices in a vector."

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by