Operations between matrix, different calculation according to conditions.
Mostrar comentarios más antiguos
I want to multiply two matrices, but depends on conditions I will operate with other expression.
If we name matrices "A" and "B", column matrices, I want to multiply them. I have two operations which I will use according to conditions to proceed.
I tried with this code:
d = [64;
108;
454;
498;
542;
586];
As = [852;
568;
568;
568;
568;
852];
fs = [-344.4991;
-168.8422;
420.0000;
420.0000;
420.0000;
420.0000];
c = 150;
if d<c
Cs(:,1) = (fs-.85*21).*As/1000;
else
Cs(:,1) = (fs).*As/1000;
end
This results in a column matrix "Cs".
Respuesta aceptada
Más respuestas (1)
James Tursa
el 17 de Abr. de 2018
Cs(:,1) = (fs-.85*21*(d<c)).*As/1000;
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!