Azzera filtri
Azzera filtri

How do I multiply different sized vectors together?

2 visualizzazioni (ultimi 30 giorni)
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)

Risposte (1)

David Hill
David Hill il 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);

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by