# I don't know how to put the answers in a row, and why the array is not being represented when I run the code.

조회 수: 1 (최근 30일)
Sara 2024년 2월 26일
댓글: Sara 2024년 2월 26일
we have collected the median grain size from 8 sedimentary rocks. The median grain size
for each sample is 0.2 m, 0.5 mm, 4 mm, 30 micrometers, 12.7 cm, 135 mm, 34 mm, and 1.1 mm. Calculate
the Krumbein phi number for each number. Use the log2() function to compute the log base two of a
number. Print the results in the command window with the sentence
For the median grain size of X mm, the Krumbein phi unit is Y.
where X is the median grain size in mm and Y is your answer. You will need to print this line eight times,
each of which represents one sample
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
John D'Errico 2024년 2월 26일
편집: John D'Errico 2024년 2월 26일
You show no code, on what is certainly your homework assignment. If you want help, we won't do your assignment for you. So you need to show what you did.

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

### 답변 (1개)

Steven Lord 2024년 2월 26일
Should some of your relational operators be less than or equal to (or greater than or equal to) instead of strictly less than or greater than?
For example, what type of material should your code report where D is exactly equal to 1 be?
D = -log2(0.5)
D = 1
isDExactly1 = D == 1
isDExactly1 = logical
1
In that case:
D < 1 % false, 1 is not strictly less than 1
ans = logical
0
D > 1 % also false, 1 is not strictly greater than 1
ans = logical
0
D <= 1 % true, 1 is less than or equal to 1
ans = logical
1
D >= 1 % also true, 1 is greater than or equal to 1
ans = logical
1
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Sara 2024년 2월 26일

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

### 카테고리

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

R2023a

### Community Treasure Hunt

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

Start Hunting!

Translated by