I have a function that gives two outputs, what is the easiest way to use fzero on only the second output

조회 수: 12 (최근 30일)
I have a function [a,b] = fun(x) when I don't want to change the function. I want to find the value of x for which b returns zero. What is the simplest way to get fzero to work here? Currently my best option is to write a second function
function [b] = fun2(x)
[~,b] = fun(x); return
but there must be a better way.

채택된 답변

David H
David H 2019년 10월 23일
No good way of doing this within Fzero, people have made that clear.

추가 답변 (1개)

Matt J
Matt J 2018년 2월 14일
but there must be a better way.
Nope.
  댓글 수: 4
Simona Giglioli
Simona Giglioli 2019년 10월 23일
But then if I use fzero in the main code, it doesn't recognise the function

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by