why can't my 2nd output argument in my function return any value?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Natalia Wong
am 4 Dez. 2015
Kommentiert: Star Strider
am 5 Dez. 2015
Hi, I 'm trying to create a function that calculates the root from the the quadratic eqn. i need to display the two roots separately but why does my second root, k not appear from the output.argument. thanks i am new to matlab
0 Kommentare
Akzeptierte Antwort
Star Strider
am 4 Dez. 2015
You have to ask it specifically for as many outputs as you want it to return. By default, if you only ask it for one, it will only return the first. This call returns all of them:
a = 2;
b = 5;
c = 10;
[j,k,group]=quadratic_roots(a,b,c)
Also, I would change:
group='non-equal complex valued roots'
to:
group='complex-conjugate roots'
11 Kommentare
Walter Roberson
am 5 Dez. 2015
That is already being dealt with in your question http://uk.mathworks.com/matlabcentral/answers/258976-i-m-having-problems-creating-a-program-that-prompts-a-user-to-guess-the-colour
Star Strider
am 5 Dez. 2015
@Natalia — If my Answer solved your problem, please Accept it.
@Walter — Thank you.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!