how to use if option

2 vues (au cours des 30 derniers jours)
surawut.A
surawut.A le 16 Sep 2021
Cs=[0.15:0.15:0.45];
Cx=0.12;
C0= 0;
%Erf=(Cs-Cx)/(Cs-C0);
Erf=[0.2 0.6 0.7333]
if Erf > 0 && Erf <=2
z=(-0.3725*(Erf^2))+(1.2144*(Erf))+(0.0006)
else if Erf >2
z=(-0.0109*((Erf)^2))+(0.0577*(Erf))+(0.9235)
end
%Erf formula above pls help to make it calculate and get 3 answer, i try many time still got only 0.6571 only 1 answer (Cs = 0.15 0.30 0.45)
and about if option
I want to use answer from above and let them choose formula, condition if ans<2 use first z formula, if ans>2 use second formula
I cant run with my code please help!
first formula z = -0.3725x^2+ 1.2144x + 0.0006
second z = -0.0109x^2 + 0.0577x + 0.9235

Réponse acceptée

Cris LaPierre
Cris LaPierre le 16 Sep 2021
See Ch 13 (Programming) of MATLAB Onramp

Plus de réponses (0)

Catégories

En savoir plus sur Argument Definitions dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by