symbolic multiplication doubt in usage of * or .*

hi guys
I`m not sure of usage the .* or * and .^ or ^ in multiplying terms for example:
if:
syms Alpha
U21=(Alpha+(Alpha.^3/D21))*cos(Alpha*X1)/2;
then wich is correct:
u2=U21.*sin(Alpha2*Zeta2) or u2=U21*sin(Alpha2*Zeta2)
or in Alpha should I use .^ or only ^
thanks a lot

 Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 17 de Oct. de 2019
Editada: KALYAN ACHARJYA el 17 de Oct. de 2019
* for scalar multiplecation
When you multiply a vector by a number, known scalar multiplication, example supoose
vec=[1,3,5,6];
m=2
result=m*vec
.* for vector dot multiplication, detail here
In the case
u2=U21*sin(Alpha2*Zeta2)

1 comentario

Same
>> a=[1 2 3 4]
a =
1 2 3 4
>> a^2
Error using ^
One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power.
>> a.^2
ans =
1 4 9 16
>> b=3
b =
3
>> b^2
ans =
9

Iniciar sesión para comentar.

Categorías

Más información sobre Operators and Elementary Operations en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by