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

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2020년 5월 8일
편집: Fangjun Jiang 2020년 5월 8일

0 개 추천

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

Sanggi Park
Sanggi Park 2020년 5월 8일
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?

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 File Operations에 대해 자세히 알아보기

태그

질문:

2020년 5월 8일

댓글:

2020년 5월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by