symbolic multiplication doubt in usage of * or .*
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Akzeptierte Antwort
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
In the case
u2=U21*sin(Alpha2*Zeta2)
1 Kommentar
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
Weitere Antworten (2)
Siehe auch
Kategorien
Mehr zu Numbers and Precision finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!