Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Problem using fzero in classed method

2 visualizzazioni (ultimi 30 giorni)
Paolo
Paolo il 29 Nov 2015
Chiuso: MATLAB Answer Bot il 20 Ago 2021
Hello, I am trying to apply fzero() to a function defined as Methods (Access = private) in a classdef, without success, here attached the .m file.
The class myclass contains: - two public methods(oper and testZero) - two private methods (setb and valzero)
I have a problem with using testZero which applies fzero to valzero. I suppose I am declaring in a wrong way the fzero parameters.
Could you please advice?
Thanks a lot in advance Best regards, P

Risposte (1)

Walter Roberson
Walter Roberson il 29 Nov 2015
av=fzero(@valzero,obj,2); is only going to pass one parameter to valzero, but you defined valzero as needing two parameters, obj and a. Perhaps you want
av = fzero(@(x) valzero(obj,x), 2);

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by