Operations between matrix, different calculation according to conditions.
Show older comments
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".
Accepted Answer
More Answers (1)
James Tursa
on 17 Apr 2018
Cs(:,1) = (fs-.85*21*(d<c)).*As/1000;
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!