matrix multiplication error with too many variables in the equation .

2 visualizaciones (últimos 30 días)
ds = C*rho^(1/6)*m_v.*0.352*Vm2^0.857;
In the above equation , m_v = 1e-3:1:1000;
however I d like to run the same equation with rho = 3.4:1:100; C = 0.2:0.1:0.9; and so on . However I am unable to do so and i get an error which says matrix dimensions dont match or first matrix dimension and second matrix dimensions dont match.
I have tried .* and .^ but the error persists. Please help me out . Thank you in advance.

Respuesta aceptada

Bjorn Gustavsson
Bjorn Gustavsson el 26 de Ag. de 2019
Your first multiply are a matrix multiplication, you can achieve what you want if you
make sure that C is a column-vector and the second factor is a row-vector (rho.^(1/6)):
C = [1;2;3];
rho = [1 3 5 7 13];
ds = C*rho.^(1/6);
If your Vm2 is a matrix with some additional sizes you might have to loop a bit more.
Then you simply might be best off by looping over the values of m_v. If C and rho doesn't change calculate that product outside of the loop.
HTH

Más respuestas (0)

Categorías

Más información sobre Array Geometries and Analysis en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by