⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fairmax.m

📁 可进行电力系统多节点系统的优化潮流计算
💻 M
字号:
function [val, idx] = fairmax(x)%FAIRMAX    Same as built-in max(), except breaks ties randomly.%   [val, idx] = fairmax(x) takes a vector as an argument and returns%   the same output as the built-in function max (see 'help max' for details.)%   with two output parameters, except that where the maximum value occurs%   at more than one position in the  vector, the index is chosen randomly%   from these positions as opposed to just choosing the first occurance.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   MATPOWER%   $Id: fairmax.m,v 1.3 2004/08/23 20:56:17 ray Exp $%   by Ray Zimmerman, PSERC Cornell%   Copyright (c) 1996-2004 by Power System Engineering Research Center (PSERC)%   See http://www.pserc.cornell.edu/matpower/ for more info.val = max(x);               %% find max valuei   = find(x == val);       %% find all positions where this occursn   = length(i);            %% number of occurencesidx = i( fix(n*rand)+1 );   %% select index randomly among occurancesreturn;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -