- #1
Prometheos
- 13
- 0
I have a program that calculates the inverse of a matrix. However, in my for loop I generate n vectors y which are nx1 vectors. The vectors are correctly calculated, but I can't figure out how to concatenate them into an nxn matrix.
The problem I think I'm having is that my vector y is generated but it isn't indexed ie y_1, y_2, or something like that. So I can't just make X=[y_1 y_2 ...]. Each time the loop runs it erases y and replaces it with the new y, so at the end I only have the nth vector left.
Does anyone know of a way to fix this so the output each loop would be [y_1] -> [y_1 y_2] -> ... n times?
This is my first program using MATLAB and I am quite stuck, thanks in advance.
The problem I think I'm having is that my vector y is generated but it isn't indexed ie y_1, y_2, or something like that. So I can't just make X=[y_1 y_2 ...]. Each time the loop runs it erases y and replaces it with the new y, so at the end I only have the nth vector left.
Does anyone know of a way to fix this so the output each loop would be [y_1] -> [y_1 y_2] -> ... n times?
This is my first program using MATLAB and I am quite stuck, thanks in advance.