Borrar filtros
Borrar filtros

Undefined function 'yout' for input arguments of type 'double'

4 visualizaciones (últimos 30 días)
Sarac el 9 de Oct. de 2014
Editada: Andrew Reibold el 9 de Oct. de 2014
I'm building a model (test1) in Matlab for Hydraulic Valve as shown in the picture below.
When i try the optimization tool i get the following error: | | | Error running optimization. Undefined function 'yout' for input arguments of type 'double'. | | |
This is the code for the objective function i use:
function F = obj_find_valve_param_a_max(x,Q_r)
% Objective function to find the maximum valve area parameter value
% Copyright 2010 MathWorks, Inc.
assignin('base','a_max', x);
% If necessary, reset parameterizaton to second option (table)
model = 'test1';
blkpth = find_system(bdroot,'ClassName','valve_dir_4_way');
k = [1 1 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2]; % Weight multipliers
% Computing objective function
F = 0;
for j = 1:11
F = F + k(j) * (yout(j) - Q_r(j))^2;
The second file:
% Script to find directional valve parameter a_max
% Copyright 2010 MathWorks, Inc.
% This script file invokes optimization process to find the orifice
% area at maximum opening for 4-way directional valve when the valve is
% modeled using the first parameterization option (linear relationship
% between control signal and orifice area).
% init_opening - vaalve initial openings [mm]
% A_leak - leakage area [m^2]
% Q_r - vector of required flow rate at 11 valve displacements
% x0 - initial value for the only variable parameter: orifice maximum area
init_opening = -1; % mm
A_leak = 1e-9; % m^2
% Vector of required flow rates. Read out from plot on page 8 in
% Eaton/Vickers Porportional Directional Valves catalog for KBFDG5V-10 valve
% Actual flow rates are determined at fixed instances of time by exporting
% flow rate measured at the external loop of the valve to the MATLAB
% workspace
Q_r = [0 0 52 150 248 346 450 540 625 670 700];
% Set initial value of the orifice maximum area
x0 = 4.8; % [cm^2]
% Optimization
[x,fval,exitflag,output] = ...
fminsearch(@obj_find_valve_param_a_max,x0, ...
%bdclose all
If i remove from the first code yout(j) - Q_r(j) the iteration finishes successfully. Please does anyone knows how to deal with this error? Thanks.

Respuestas (1)

Andrew Reibold
Andrew Reibold el 9 de Oct. de 2014
Editada: Andrew Reibold el 9 de Oct. de 2014
yout is not a default Matlab function and hasn't been saved as a variable yet either. You, or a peer/coworker must have written it.
You need a copy of it, and you need to make sure it is saved in the working directory.


Más información sobre Modeling Fundamentals and Processes en Help Center y File Exchange.


Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by