How can I change values in my matrix according to conditions.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hannah Pickering
le 7 Fév 2017
Réponse apportée : Chad Greene
le 7 Fév 2017
I have a zeros(size,size) matrix that i want the values to change depending on my conditions. I have two conditions:
Support = FixedFixed or Support = PinnedPinned
When Support = FixedFixed my matrix coordinates should be
a(1,1) = 7;
a(1,2) = -4;
a(1,3) = 1;
a(size,size-2)=1;
a(size,size-1)=-4;
a(size,size)=7;
and when Support = PinnedPinned my matrix should be
a(1,1) = 5;
a(1,2) = -4;
a(1,3) = 1;
a(size,size-2)=1;
a(size,size-1)=-4;
a(size,size)=5;
can anyone help me code this?
0 commentaires
Réponse acceptée
Chad Greene
le 7 Fév 2017
switch SupportType
case 'PinnedPinned'
a(1,1) = 5;
a(1,2) = -4;
a(1,3) = 1;
a(size,size-2)=1;
a(size,size-1)=-4;
a(size,size)=5;
case 'FixedFixed'
a(1,1) = 7;
a(1,2) = -4;
a(1,3) = 1;
a(size,size-2)=1;
a(size,size-1)=-4;
a(size,size)=7;
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Operating on Diagonal 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!