How to multiply 22x1 double with scalar?
5 views (last 30 days)
Show older comments
Hi
I want to multiply like in the following code:
delta_x(i) = dx(i).*1.5;
type of dx is 22x1 double. 1.5 is scalar as you can see. When I do it like shown I get 22x1 double consisting of zeros. How do I have to multiply it, to get the right answer?
Thanks a lot
1 Comment
Accepted Answer
Torsten
on 30 Apr 2022
If dx = 0 for all i, getting all zeros for delta_x is the right answer.
If you want to multiply delta_x by a scalar in a loop, use
delta_x(i ) = delta_x(i)*1.5;
3 Comments
More Answers (0)
See Also
Categories
Find more on Data Type Conversion 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!