How to write a function?

5 visualizzazioni (ultimi 30 giorni)
zizo
zizo il 15 Mag 2011
[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 Commenti
Oleg Komarov
Oleg Komarov il 15 Mag 2011
http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
Walter Roberson
Walter Roberson il 15 Mag 2011
What if n>=10 and n<50 ? You have not defined any result for that case.

Accedi per commentare.

Risposte (1)

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

Categorie

Scopri di più su Elementary Math in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by