Solving unknown matrix with iterated column vector
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi!
I have a question about how to solve unknown matrix with known column vectors where one of the vectors has to keep iterating with different values. I have a system:
F = C*s
where
F is a known column matrix 4x1 of form F = [40; 0; 0; 0] and 40 has to keep iterating over the process to the 2nd, 3rd, 4th spot while other values stay 0,
C is unknown square matrix 4x4,
s is known column matrix 4x1 of random numbers
What I'm currently using is
f = 40;
F = [f; 0; 0; 0]; % this has to be iterated with f changing places
S = randn(4,1);
C = F*pinv(S); % I'm not sure about the validity of this, but at least gives me some results
now I have tried searching for a similar question but haven't found much - I can't find anything that would give me a "suitable" result. From the code you can see that I get the first result, since I set the F that way, but then whatever I try to do the iteration with (they told me to "loop", but I noticed that some don't recommend it), I didn't get a good answer. Also, with pinv() I always get the same result when I change the position of f and I don't think that's the right approach for this case.
Does anyone have any tips on how to solve this? Or maybe I'm just using the wrong approach. Any help would be greatly appreciated! :)
0 commentaires
Réponses (1)
Luca Ferro
le 24 Mai 2023
i'm not really quite sure about what operation you are trying to solve and how to solve it, but for theF iteration part this works:
f = 40;
S = randn(4,1);
for ii=1:4
F=zeros(1,4);
F(ii)=f
%HERE THE OPERATION YOU WANT TO CARRY
end
1 commentaire
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements 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!