function y=aQ=[1 2;3 4;5 6];X=[1 0 1;0 1 0];disp(Q);s=[2000 3000;1000 4000;2000 3000];disp(s);a=[(s(1,1))*(Q(1,1)) (s(1,2))*(Q(1,2)); (s(2,1))*(Q(2,1)) (s(2,2))*(Q(2,2)); (s(3,1))*(Q(3,1)) (s(3,2))*(Q(3,2))];disp(a);y=sum(a(:));end
MATLAB: How to perform this multiplication form or by using loop
for loopmatlab functionmatrixmatrix arraymatrix manipulationmultiple
Related Question
- Dear friends, the long matlab command that I have written is error. I want to be spelled the same way but without error.
- Extracting a matrix by row and column from a large matrix
- The headerlines are not always properly detected by readtable
- How to write Continue Long Statements on Multiple Lines
- I want to use all the values present in two arrays but if I run for loops (ie) I used two for loops but only the last value of both the arrays are taken. What is the syntax so that I can use all the values of both arrays simultaneously.
Best Answer