代码中有函数或变量“p”无法识别,优化误差

3 Ansichten (letzte 30 Tage)
hui Liu
hui Liu am 2 Dez. 2022
Beantwortet: Tushar am 23 Mär. 2023
am为函数z的最大值对应的横坐标值,代码没有错误,但是运行总是错误

Antworten (1)

Tushar
Tushar am 23 Mär. 2023
Hi,
The error message you are seeing is likely due to the fact that the variable p is not defined before it is used in the code. Specifically, the line am = fsolve(fun2, p(2)/(p(1)+p(2))); is trying to use the value of p before it has been assigned a value.
To fix this error, you can define p before using it in the code.
Hope it helps!

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!