How to multiply 22x1 double with scalar?

조회 수: 3 (최근 30일)
Bersin Tekmen
Bersin Tekmen 2022년 4월 30일
댓글: Bersin Tekmen 2022년 4월 30일
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
Torsten
Torsten 2022년 4월 30일
If dx = 0 for all i, getting all zeros for delta_x is the right answer.

댓글을 달려면 로그인하십시오.

채택된 답변

Torsten
Torsten 2022년 4월 30일
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
Torsten
Torsten 2022년 4월 30일
One has to see the context - please include the relevant part of your code.
Bersin Tekmen
Bersin Tekmen 2022년 4월 30일
@Torsten thanks I solved the problem. I used the wrong counter variable.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by