필터 지우기
필터 지우기

how do I substitute the values inside the vector?

조회 수: 3 (최근 30일)
Aymen
Aymen 2023년 1월 28일
답변: Sarthak 2023년 2월 9일
If you have a vector x = [1.92 , 0.05 , -2.43 , -0.02, 0.09, 0.85 , 0.06, -0.05, 0.3214, 25, 1 ,5 ,10 , 0.0125 , 100 ] do the following:
a. Replace any value between 1 and 4 with zero
b. Multiply any negative value with -1
c. Add 100 for the number that larger than or equal 5
d. Subtract 50 for the number that are smaller than 5
  댓글 수: 2
Torsten
Torsten 2023년 1월 28일
Look up "logical indexing".
Jan
Jan 2023년 1월 28일
@Aymen: This is a homework question. Then please post, what you have tried so far and ask a specific question. The forum will assist you, but we will not solve your homework.

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

답변 (1개)

Sarthak
Sarthak 2023년 2월 9일
Hi,
You can look up to “Logical Indexing” section in the following documentation:
Try applying the same concept and try the questions then.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by