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 visualizaciones (últimos 30 días)
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 comentario
John D'Errico
John D'Errico el 26 de Feb. de 2024
Editada: John D'Errico el 26 de Feb. de 2024
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.

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 26 de Feb. de 2024
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

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by