Write a function quadraticSolver that takes one 3-element array input and returns two outputs (root condition and root values). Use an if-elseif-else structure in your code.

Variable rootCondition must be of data type double. It is currently of type uint8. Check where the variable is assigned a value.
This is in red and i don't know what to change

Risposte (1)

The error message apparently tells you your array is composed of uint8 numbers.
How do you convert a variable of integer type, into a double? As a hint:
help double
DOUBLE Convert to double precision. DOUBLE(X) returns the double precision value for X. If X is already a double precision array, DOUBLE has no effect. DOUBLE is called for the expressions in FOR, IF, and WHILE loops if the expression isn't already double precision. DOUBLE should be overloaded for all objects where it makes sense to convert it into a double precision value. See also SINGLE, DATATYPES, ISFLOAT, ISNUMERIC. Documentation for double doc double Other uses of double categorical/double map.geotiff.RPCCoefficientTag/double codistributed/double matlab/double dataset/double opaque/double datetime/double opc.hda.Data/double dlarray/double quaternion/double dsp/double signal/double duration/double StaticModel/double filtstates/double string/double fixedpoint/double symbolic/double gpuArray/double tabular/double

Categorie

Scopri di più su Language Fundamentals in Centro assistenza e File Exchange

Richiesto:

il 20 Feb 2023

Risposto:

il 21 Feb 2023

Community Treasure Hunt

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

Start Hunting!

Translated by