Hello.... I need help regarding saving values of for loop.. i am running a program having 7 variables calculating in 1 iteration and i made 50 iterations so there is a 7*50 matrix form ...but i get results in seperate not in a matrix form? how can i
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Wajeeha Najeeb
le 25 Fév 2016
Commenté : Wajeeha Najeeb
le 25 Fév 2016
X = X(:)-mean(X(:));
X = X./std(X,1);
N = length(X);
M20 = mean(X.^2);
M21 = mean(X.*conj(X));
M22 = mean(conj(X).^2);
M40 = mean(X.^4);
M41 = mean(X.^3.*conj(X));
M42 = mean(X.^2.*conj(X).^2);
M43 = mean(X.*conj(X).^3);
M60 = mean(X.^6);
M61 = mean(X.^5.*conj(X));
M62 = mean(X.^4.*conj(X).^2);
M63 = mean(X.^3.*conj(X).^3);
C40 = M40 - 3*M20^2;
C41 = M41 - 3*M20*M21;
C42 = M42 - abs(M20)^2 - 2*M21^2;
C60 = M60 - 15*M20*M40 + 30*M20^3;
C61 = M61 - 5*M21*M40 - 10*M20*M41 + 30*M20^2*M21;
C62 = M62 - 6*M20*M42 - 8*M21*M41 - M22*M40 + 6*M20^2*M22 + 24*M21^2*M20;
C63 = M63 - 9*M21*M42 + 12*M21^3 - 3*M20*M43 - 3*M22*M41 + 18*M20*M21*M22;
M = [M20 M21 M22 M40 M41 M42 M43 M60 M61 M62 M63];
C = [C40 C41 C42 C60 C61 C62 C63];
0 commentaires
Réponse acceptée
Walter Roberson
le 25 Fév 2016
Modifié(e) : Walter Roberson
le 25 Fév 2016
for IterationNumber = 1 : 50
X = ...
...
M(:, IterationNumber) = [M20 M21 M22 M40 M41 M42 M43 M60 M61 M62 M63];
C(:, IterationNumber) = [C40 C41 C42 C60 C61 C62 C63];
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!