Problem 2529. Solving Quadratic Equations (Version 2)
Before attempting this problem, solve version 1: https://www.mathworks.com/matlabcentral/cody/problems/2510-solving-quadratic-equations-version-1.
In this version, the discriminant can have any value. Complete the function so if the discriminant is negative, the function returns values of NaN --- "Not a Number" --- for x1 and x2. Otherwise, the function computes x1 and x2 as before using the formula
![](https://dl.dropboxusercontent.com/u/57773343/__IMAGES/QuadraticSolution1.gif)
Solution Stats
Problem Comments
-
1 Comment
Michael C.
on 25 Nov 2014
No need to fear complex roots...
Solution Comments
Show commentsProblem Recent Solvers82
Suggested Problems
-
Swap the first and last columns
19824 Solvers
-
674 Solvers
-
Side of an equilateral triangle
5967 Solvers
-
488 Solvers
-
Matlab Basics II - Determine if an array has a 3rd dimension
145 Solvers
More from this Author6
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!