fzero ,,Error using fzero (line 308) Initial function value must be finite and real.''

2 vues (au cours des 30 derniers jours)
Flintstone
Flintstone le 19 Nov 2021
Hallo, ich bin neu in Matlab und möchte einen Code analysieren:
Die Hauptfunktion ist angehängt als Frage_Main, die Hilfs-Funktion, welche die Fehlermeldung ausgibt ist ,,Frage_side_function''. Abhängig von p (p>22.2) erhält man eine Fehlermeldung in ,,Frage_side_function'':
- ,,Error using fzero (line 308) Initial function value must be finite and real.'' Z.30
Dabei ist der Initial function value start(i) (wird in Z. 16 definiert). Ich habe zum testen des Codes, die Werte von start ausgeben lassen, um zu Prüfen welche Input Werte ,,finite oder nicht real sind''. Dabei handelt es sich um eine wiederholte Ausgabe der Werte 0.6781 1.3563 2.0344 2.7125 3.3907 4.0688 4.7470 5.4251 6.1032
Ich Frage mich jetzt woran es liegt das trotz realer und endlicher Eingaben eine solche Fehlermeldung zustandekommt. Vielleicht kann mir jemand helfen.
Liebe Grüße
:)

Réponses (1)

Kumar Pallav
Kumar Pallav le 24 Nov 2021
Hi,
Refer this for similar problem. The cause of this error is that the objective function is calling 'fzero', but for certain inputs the evaluated values were 'Inf', which caused the error. The issue was resolved by setting a conditional breakpoint to catch 'Inf' values and observe the data that was entered into its calculation.

Tags

Community Treasure Hunt

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

Start Hunting!