For example, I want to calculate if 0<d<2, F=2*d if 2<d<3, F=5*d
I tried to figure it out but It is beyond my ability. Please help me

 Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 8 de Mayo de 2020
Editada: Fangjun Jiang el 8 de Mayo de 2020

0 votos

d=1;
if and(d>0, d<2)
F=2*d;
elseif and(d>2, d<3)
F=5*d;
end
You can also use "if d>0 && d<2" instead. Type "help relop" to learn about relational operators.

1 comentario

Sanggi Park
Sanggi Park el 8 de Mayo de 2020
Thanks for answer! And could you help me that If i scale d as 0:0.5:4 and want to know all the F value, what command should I input?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre File Operations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 8 de Mayo de 2020

Comentada:

el 8 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by