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.

3 ビュー (過去 30 日間)
Sara
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 件のコメント
John D'Errico
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
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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by