How to write a function?

조회 수: 5 (최근 30일)
zizo
zizo 2011년 5월 15일
[EDIT: Wed Jun 15 04:15:02 UTC 2011 - Reformat - MKF]
hey . my q is . write this program with use ((function))
1- if n<10 or=50 m=n*p*0.9
2- if n>50 or n<=100 m= n*p*0.7
3- if n>100 m= n*p*0.6
help me please
  댓글 수: 2
Oleg Komarov
Oleg Komarov 2011년 5월 15일
http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
Walter Roberson
Walter Roberson 2011년 5월 15일
What if n>=10 and n<50 ? You have not defined any result for that case.

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

답변 (1개)

Walter Roberson
Walter Roberson 2011년 5월 16일
Hint:
function a = b(c,d,e,f)
a = nan;
if c > d and c <= e
a = c * f * 5;
end
end

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by