Command for perfect matrix multiplication. Command gives perfect size of matrix
3 views (last 30 days)
Show older comments
Ts
Ts(:,:,1) =
0.5000 0.5000 1.0000
0.5000 0.5000 -1.0000
-0.5000 0.5000 0
Ts(:,:,2) =
0.5000 0.5000 1.0000
0.5000 0.5000 -1.0000
-0.5000 0.5000 0
Ts(:,:,3) =
1 0 0
0 1 0
0 0 1
Ts(:,:,4) =
1 0 0
0 1 0
0 0 1
Ts(:,:,5) =
1 0 0
0 1 0
0 0 1
L
L(:,:,1) =
1.0e-04 *
0.1215
0.1215
-0.2570
L(:,:,2) =
1.0e-04 *
0.1215
0.1215
-0.2570
L(:,:,3) =
1.0e-04 *
-0.0070
0.2500
0
L(:,:,4) =
1.0e-04 *
-0.0070
0.2500
0
L(:,:,5) =
1.0e-04 *
-0.0070
0.2500
0
STs
STs(:,:,1) =
1.0e-07 *
-0.3210 -0.3210 0.6015
STs(:,:,2) =
1.0e-07 *
-0.3210 -0.3210 0.6015
STs(:,:,3) =
1.0e-07 *
-0.0203 -0.6218 0
STs(:,:,4) =
1.0e-07 *
-0.0203 -0.6218 0
STs(:,:,5) =
1.0e-07 *
-0.0203 -0.6218 0
>> If i using bsxfun(@times, Ts,L); it gives wrong size of matrix. i need command for [3*3]*[3*1] gives [3*1] matrix. [1*3]*[3*1] gives [1] value. please tell command for array multiplication for every size.[3*1]*[1*3] give[3*3].
0 Comments
Accepted Answer
Walter Roberson
on 31 Oct 2015
Edited: Walter Roberson
on 1 Nov 2015
temp = arrayfun(@(J) Ts(:,:,J)*L(:,:,J), 1:size(Ts,3), 'Uniform', 0);
STs = cell2mat(reshape(temp,1,1,[]));
5 Comments
Walter Roberson
on 1 Nov 2015
Not unless you do a lot of work to define STs in terms of a class that gives the units as part of the display.
I do not understand what you mean by "it's disp stands out". You asked "after every STs(:,:,i) show N/m^2" and that is what you get. For example,
STs(:,:,1) = N/m^2
0.188001526199785 0.11424886510142 0.107687728046081
0.111973001256813 0.222441422169407 0.362939604152811
0.626849792977697 0.312785095840677 0.200911101587562
STs(:,:,2) = N/m^2
0.622262777115983 0.327396680058041 0.421739252162982
1.17195405095794 0.45294485413646 0.612747199403293
1.56288846761804 0.486662493250459 0.700386125146523
After every STs(:,:,i) it displays N/m^2 like you asked.
Do you mean that after every value you would like N/m^2 ? If so then it requires a class to have it printed automatically, but you can code
fmt = repmat('%10g N/m^2 ', 1, size(STs,2));
fmt(end:end+1) = '\n';
for P = 1 : size(STs,3)
fprintf('\nSTs(:,:,%d) =\n', P);
fprintf(fmt, STs(:,:,P).');
end
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices 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!