symbolic multiplication doubt in usage of * or .*

2 Ansichten (letzte 30 Tage)
atabak mostafavi
atabak mostafavi am 17 Okt. 2019
Beantwortet: atabak mostafavi am 18 Okt. 2019
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

Akzeptierte Antwort

KALYAN ACHARJYA
KALYAN ACHARJYA am 17 Okt. 2019
Bearbeitet: KALYAN ACHARJYA am 17 Okt. 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 Kommentar
KALYAN ACHARJYA
KALYAN ACHARJYA am 18 Okt. 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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

atabak mostafavi
atabak mostafavi am 18 Okt. 2019
Thank you Kaylan, and how about the ^ and .^ ?

atabak mostafavi
atabak mostafavi am 18 Okt. 2019
many thanks

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by