source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/@sdpvar/var.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 454 bytes
Line 
1function varargout=median(varargin)
2%VAR (overloaded)
3%
4% V = var(x)
5
6% Author Johan Löfberg
7% $Id: var.m,v 1.1 2006/05/16 12:32:35 joloef Exp $
8
9x = varargin{1};
10
11if nargin > 1 | min(size(x))>1
12    error('SDPVAR/VAR only supports simple 1-D variance'),
13end
14
15switch length(x)
16    case 1
17        varargout{1} = x;
18    otherwise
19        x = reshape(x,length(x),1);
20        m = sum(x)/length(x);
21        varargout{1} = ((x-m)'*(x-m)) / (length(x) - 1);
22end
Note: See TracBrowser for help on using the repository browser.