Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

matrix manipulation and arrays manipulation

2 vues (au cours des 30 derniers jours)
Amine Ben Ayara
Amine Ben Ayara le 13 Déc 2016
Dear Matlab community, I apologize in advance if I may have asked too many questions as suggested by some users on here. I usually get all kind of help from bright and fantastic individuals through MathWorks. I am having some trouble getting a result that I need using two matrices with different dimensions. I attached a code with an extracted portion of these matrices to better elaborate what I am doing and hoping to achieve, I will also pasted it on here just in case:
%%%%%%Extracted 10 rows and 3 columsn from A(73400 by 30)(noting that nbr
%%%%%%or rows in A is = (14680 of (5*1) stacked) so that's why I need to
%%%%%%do the sump of the product in 5 rows at the time from A
%%%Matrix B(14680*5)
%%Objective Matrix is C(14680*30) with each element in C(i,j)= sumProduct(transpose(A(5*1).*B(i,:))
%%Example:
A1=[-20.6860046107437,-20.8259490953586,-20.5295141167041;-4.68083651024847,-4.38170600425412,-4.04039850536564;-5.32219353656980,-4.99820840303045,-4.62367652177701;0,0,0;0,0,0;-13.3475398510192,-10.9590900264805,-8.87951051472035;-0.0119489044851285,-0.00952917816601411,-0.00754907814411214;0,0,0;0,0,0;0,0,0];
B11=[2.48618841134752e-06,1.78727800000000e-06,0,0,0;2.56419915269461e-06,1.78727800000000e-06,0,0,0];
C(1,1)=sum(A1(1:5,1)'.*B11(1,:)) % 1st element in C(14680*30)
C(2,1)=sum(A1(6:10,1)'.*B11(2,:))% 2nd element in C(14680*30)
....
%%until all the 14680 of (5*1) are reached so C(14680*1)
%%now same thing needs to be done but moving in the 2nd Column of A(:,2)
C(1,2)=sum(A1(1:5,2)'.*B11(1,:)) % Still 1st row of B
C(2,2)=sum(A1(6:10,2)'.*B11(2,:))% Still 2nd row of B
%%continue until all 14680 rows and 14680 of (5*1) are used, then move to
%%next column nbr 3 from A(:,3)
C(1,3)=sum(A1(1:5,3)'.*B11(1,:)) % Still 1st row of B
C(2,3)=sum(A1(6:10,3)'.*B11(2,:))% Still 2nd row of B
%%%the final dimension of C is then (14680 by 30)
  8 commentaires
Amine Ben Ayara
Amine Ben Ayara le 13 Déc 2016
@ Stephen, it is not really a duplicate. That question was somehow closed and I was told to make an example of what the operation I needed and here I attached a portion of m. script as an illustration to what I need help with. Thanks
Walter Roberson
Walter Roberson le 4 Jan 2017
It is really a duplicate. If you had new information you should have updated the previous question.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by