I am having trouble getting this code to run. The goal is to minimize the cost of a dumpster while keeping within a certain volume range using lagrange multipliers. My code runs but the error message that comes up is "Failure in initial objective function evaluation. FSOLVE cannot continue.". I am pretture sure lines 9 and 10 are wrong but can someone help me with this?
function F = Dumpster(quad)
L = quad(1);
W = quad(2);
H = quad(3);
X = quad(4);
F = [5*W+6*H-(W*H),5*L+6*H-(H*L),6*L+6*W-(W*L),L*W*H-1056];
Note that you have written a recursive function. This means you call Dumpster, inside which you call fsolve which in turn calls Dumpster. Then inside that Dumpster call you call fsolve which in turn calls Dumpster. Then inside that Dumpster call you call fsolve which in turn calls Dumpster. Then inside that Dumpster call you call fsolve which in turn calls Dumpster. Then inside that Dumpster call you call fsolve which in turn calls Dumpster. Then inside that Dumpster call you call fsolve which in turn calls Dumpster. Then inside that Dumpster call you call fsolve which in turn calls Dumpster. Then inside that Dumpster call you call fsolve which in turn calls Dumpster... etc.
Ahh so its basically looping itself? How can I fix that? I am trying to minimize the cost which is what all of the equaitions in the array is. I am new to MATLAB sorry this is probably a dumb problem lol
I just pulled fsolve outside of the function and it is giving me the same error message. Do I need to put the fsolve ourside of the script and into the command window?
Just got it all figured out! Had to put a ; after the fsolve into the command prompt in order to suppress it getting the critical points! Thank you for the help
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Translated by
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.