source:
proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/@sdpvar/var.m
Last change on this file was 37, checked in by , 14 years ago | |
---|---|
File size: 454 bytes |
Line | |
---|---|
1 | function 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 | |
9 | x = varargin{1}; |
10 | |
11 | if nargin > 1 | min(size(x))>1 |
12 | error('SDPVAR/VAR only supports simple 1-D variance'), |
13 | end |
14 | |
15 | switch 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); |
22 | end |
Note: See TracBrowser
for help on using the repository browser.