How can I save an entire matrix?
Show older comments
Hi! I am solving matrixs and getting an X matrix for each loop. How can I save in an matrix every value of X that I get after each loop? Because after I need to see which value is the lowest. Thanks!
Q=[0.005 0.01 0.02 0.03]';
S=[0.45 1.1 3.3 6.7]';
b=0.1;
c=1/b;
for n=2.1:b:5
%Matriz con Q y S
M=[Q(1)^2+Q(2)^2+Q(3)^2+Q(4)^2, Q(1)^(n+1)+Q(2)^(n+1)+Q(3)^(n+1)+Q(4)^(n+1);
n*(Q(1)^n+Q(2)^n+Q(3)^n+Q(4)^n),n*(Q(1)^(2*n-1)+Q(2)^(2*n-1)+Q(3)^(2*n-1)+Q(4)^(2*n-1))];
%Matriz de la igualdad
N=[S(1)*Q(1)+S(2)*Q(2)+S(3)*Q(3)+S(4)*Q(4);
n*(S(1)*Q(1)^(n-1)+S(2)*Q(2)^(n-1)+S(3)*Q(3)^(n-1)+S(4)*Q(4)^(n-1))];
%Solucion de la matriz es:
X=M\N
end
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!