matrix multiplication of any 2 matrix in which a matrix contains a variable term suppose m=0:0.1:5.....how to do this multiplication for each value of m by creating a loop.....
Show older comments
matrix multiplication of any 2 matrix in which a matrix contains a variable term suppose m=0:0.1:5
1 Comment
UJJWAL BARMAN
on 2 Aug 2015
Edited: Geoff Hayes
on 2 Aug 2015
Answers (1)
Geoff Hayes
on 2 Aug 2015
Ujjwal - please describe how you are multiplying the above two matrices. Is it
K*F
or something else? If m is a variable, then you would want to initialize m before you do the matrix multiplication. Something like
mValues=0:0.1:5;
results = zeros(3,1,length(mValues));
for k=1:length(mValues)
m = mValues(k);
F=[1-2*cos(alpha1)+2*cos(alpha2)-2*cos(alpha3)-(pi/4)*m;
1-2*cos(5*alpha1)+2*cos(5*alpha2)-2*cos(5*alpha3);
1-2*cos(7*alpha1)+2*cos(7*alpha2)-2*cos(7*alpha3)];
K=[2*sin(alpha1) -2*sin(alpha2) 2*sin(alpha3);
10*sin(5*alpha1) -10*sin(5*alpha2) 10*sin(5*alpha3);
14*sin(7*alpha1) -14*sin(7*alpha2) 14*sin(7*alpha3)];
results(:,:,k) = K*F;
end
1 Comment
UJJWAL BARMAN
on 3 Aug 2015
yes,the two matrix multiplication will be K*F.thank you for your answer.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!