symbolic multiplication doubt in usage of * or .*

2 views (last 30 days)
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

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 17 Oct 2019
Edited: KALYAN ACHARJYA on 17 Oct 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 Comment
KALYAN ACHARJYA
KALYAN ACHARJYA on 18 Oct 2019
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

Sign in to comment.

More Answers (2)

atabak mostafavi
atabak mostafavi on 18 Oct 2019
Thank you Kaylan, and how about the ^ and .^ ?

atabak mostafavi
atabak mostafavi on 18 Oct 2019
many thanks

Tags

Community Treasure Hunt

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

Start Hunting!