how to use if option

조회 수: 5 (최근 30일)
surawut.A
surawut.A 2021년 9월 16일
답변: Cris LaPierre 2021년 9월 16일
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

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 9월 16일
See Ch 13 (Programming) of MATLAB Onramp

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Argument Definitions에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by