How do I do an if greater than or less than for a if statement

47 visualizaciones (últimos 30 días)
Kaden Bauernfeind
Kaden Bauernfeind el 8 de Mayo de 2022
Editada: Jan el 8 de Mayo de 2022
I need to do a question wehre it needs to be greater than or less than a certain limit.
This is specifically over g force so it needs to be greater tha -8g and less than 8g otherwise it displays a fail message

Respuestas (1)

Jan
Jan el 8 de Mayo de 2022
Editada: Jan el 8 de Mayo de 2022
if f <= -8 || f >= 8
error('f is outside the valid range')
end
Alternative:
if abs(f) >= 8

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by