How do I multiply different sized vectors together?
2 views (last 30 days)
Show older comments
I am attempting to use repmat() to continue a pattern of data so I can multiply the same sized arrays. Angle is single column, three row array that varies from 10,20,30 degrees. Height is only 500mm or 300mm in a single column and two row array. e is an array from 0.5 to 1 in 0.01 increments. How can I manipulate these arrays so that I can use the equation for distance (d) below? Thanks :)
e = [0.5:0.01:1];
THETA = load('ExcelWorkspace', 'Angle');
H = load('ExcelWorkspace', 'Height');
theta = repmat(THETA,1,51)
h = repmat(H,1,51)
d = 2*h.*sin(2*theta)*(e*(cos(theta).^2)-sin(theta).^2).*(1+e)
0 Comments
Answers (1)
David Hill
on 22 Apr 2022
e = 0.5:0.01:1;
h = [300 500];
a = [10 20 30];
[E,H,theta]=meshgrid(e,h,a);%all combinations into the same sized matrices
d = 2*H.*sind(2*theta).*(E.*(cosd(theta).^2)-sind(theta).^2).*(1+E);
0 Comments
See Also
Categories
Find more on Matrices and Arrays 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!