Calculate power of exponential

2 visualizaciones (últimos 30 días)
gio kapanadze
gio kapanadze el 23 de Abr. de 2021
Comentada: Daniel Pollard el 23 de Abr. de 2021
How can i calculate , if A=[8 7 0] and B=[2 12 1];
I tried this code:
A = [8 7 0];
B = [2 12 1];
C = exp(A)
C*B
Matlab keeps giving error: Inner matrix dimensions must agree.

Respuesta aceptada

Daniel Pollard
Daniel Pollard el 23 de Abr. de 2021
Deleted my previous answer as I hadn't seen your edit so gave a wrong answer.
You need a . before the multiplication symbol. Try
A = [8 7 0];
B = [2 12 1];
C = exp(A)
sum(C.*B)
C.*B computes element-wise multiplication of C and B, then sum them to calculate the do product.
  4 comentarios
Steven Lord
Steven Lord el 23 de Abr. de 2021
I see no mention of dot product in the question. But if that was the original posters request, use the dot function instead of the multiplication operators * or .* to compute the dot product.
Daniel Pollard
Daniel Pollard el 23 de Abr. de 2021
Are we seeing different versions of the question? To me it says
"How can I calculate , if A=[8 7 0] and B=[2 12 1]" before they outline what they tried and the error it returned.

Iniciar sesión para comentar.

Más respuestas (1)

Mike
Mike el 23 de Abr. de 2021
C.*B
* by itself means matrix multiply
.* means multiply individual terms

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by