フィルターのクリア

how can i multiply 2 matrices with different dimension ?

5 ビュー (過去 30 日間)
ladan hz
ladan hz 2017 年 10 月 25 日
コメント済み: Walter Roberson 2017 年 10 月 26 日
i have Rr=3*3 matrices and PQRg=3*110 and i want to multiply them and get AnVel=[Rr]*[PQRg]which is 3*110 ? how is possible?
  3 件のコメント
ladan hz
ladan hz 2017 年 10 月 26 日
編集済み: Walter Roberson 2017 年 10 月 26 日
actually i want to do it in alopp and its not work :( thats the problem ,i know the law and its works outside of the loop :(
for i=1:111
xx=XG(:,i)/norm(XG(:,i));
yy=YG(:,i)/norm(YG(:,i));
zz= ZG(:,i)/norm(ZG(:,i));
Rr=[xx,yy,zz];
determinante=det(Rr);
time=[1:1:111]';
Time=time/120;
[R1 R2 R3]=dcm2angle (Rr); %[yaw, pitch, roll] = dcm2angle( dcm )
TableTeta(i,:)=[R2];
TableFi(i,:)=[R1];
TableAlfa(i,:)=[R3];
deFi= diff(TableFi);
deAlfa= diff(TableAlfa);
deTeta=diff(TableTeta);
%VELOCITà ANGOLARE
Pg=(deAlfa*sin(TableFi(i,:))*sin(TableTeta(i,:))+deFi*cos(TableTeta(i,:))).*120;
Qg=(deAlfa*sin(TableFi(i,:))*cos(TableTeta(i,:))-deFi*sin(TableTeta(i,:))).*120;
Rg=(deAlfa*cos(TableFi(i,:))+deTeta).*120;
PG=Pg';
QG=Qg';
RG=Rg';
PQRg=[PG; QG; RG]
AnVel1=Rr*PQRg;
AnVel=[AnVel1]';
end
Walter Roberson
Walter Roberson 2017 年 10 月 26 日
You are overwriting all of AnVel every iteration of the "for" loop. It seems unlikely that is what you want to do.

サインインしてコメントする。

回答 (2 件)

John D'Errico
John D'Errico 2017 年 10 月 25 日
Um, read the getting started tutorials?
AnVel = Rr*PQRg;
It is legal to read the documentation. You might even learn how to use the language.
  1 件のコメント
ladan hz
ladan hz 2017 年 10 月 26 日
編集済み: Walter Roberson 2017 年 10 月 26 日
sorry but this is not working inside a loop which i send you the loop now ??
for i=1:111
xx=XG(:,i)/norm(XG(:,i));
yy=YG(:,i)/norm(YG(:,i));
zz= ZG(:,i)/norm(ZG(:,i));
Rr=[xx,yy,zz];
determinante=det(Rr);
time=[1:1:111]';
Time=time/120;
[R1 R2 R3]=dcm2angle (Rr); %[yaw, pitch, roll] = dcm2angle( dcm )
TableTeta(i,:)=[R2];
TableFi(i,:)=[R1];
TableAlfa(i,:)=[R3];
deFi= diff(TableFi);
deAlfa= diff(TableAlfa);
deTeta=diff(TableTeta);
%VELOCITà ANGOLARE
Pg=(deAlfa*sin(TableFi(i,:))*sin(TableTeta(i,:))+deFi*cos(TableTeta(i,:))).*120;
Qg=(deAlfa*sin(TableFi(i,:))*cos(TableTeta(i,:))-deFi*sin(TableTeta(i,:))).*120;
Rg=(deAlfa*cos(TableFi(i,:))+deTeta).*120;
PG=Pg';
QG=Qg';
RG=Rg';
PQRg=[PG; QG; RG]
AnVel1=Rr*PQRg;
AnVel=[AnVel1]';
end

サインインしてコメントする。


KSSV
KSSV 2017 年 10 月 25 日
YOu can happily multiply them using *.
Rr = rand(3,3) ;
PQRg = rand(3,110) ;
P = Rr*PQRg
Remmember multiplication law?

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by