symbolic multiplication doubt in usage of * or .*
2 views (last 30 days)
Show older comments
atabak mostafavi
on 17 Oct 2019
Answered: atabak mostafavi
on 18 Oct 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 Comments
Accepted Answer
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
In the case
u2=U21*sin(Alpha2*Zeta2)
1 Comment
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
More Answers (2)
See Also
Categories
Find more on Numbers and Precision in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!