필터 지우기
필터 지우기

Using if and then statements

조회 수: 2 (최근 30일)
lucas erickson
lucas erickson 2015년 9월 17일
편집: Rick Rosson 2015년 9월 17일
Write a MATLAB program to compute both roots of the quadratic equation as you input the values of a, b, and c. &nbsp Requirements:
a) Use “input” to ask the user to put in the values of a, b and c
b) Use “if” structure to avoid division by zero and complex roots
c) Print out the roots for the following situations:
(1). a=2, b=10, c=12
(2). a=0, b=10, c=4
(3). a=4, b=10, c=100
  댓글 수: 1
Stephen23
Stephen23 2015년 9월 17일
Do you actually have a question, or do you just want us to do your homework for you?

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

답변 (1개)

Rick Rosson
Rick Rosson 2015년 9월 17일
편집: Rick Rosson 2015년 9월 17일
function r = findQuadraticRoots(a,b,c)
if something is true
do some stuff;
else
do some other stuff;
end
end

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by