Code covered by the BSD License  

Highlights from
Delta Sigma Toolbox

image thumbnail

Delta Sigma Toolbox


Richard Schreier (view profile)

  • 1 file
  • 4.59459


14 Jan 2000 (Updated )

High-level design and simulation of delta-sigma modulators

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

function out = outconvex2d(x,p)
%function out = outconvex2d(x,p)
%Test if each of the x points are inside the convex polygon p,
%and return the number of inequalities failed by each point.
%p is a 2xn counter-clockwise list of vertices,
%with the first vertex duplicated.
n = size(p,2);

% form A,B such that internal points satisfy Ax <= B
A = [	p(2,2:n) - p(2,1:n-1);
	p(1,1:n-1) - p(1,2:n)]';
B = zeros(n-1,1);
for i=1:n-1
    B(i) = A(i,:)*p(:,i);

out = sum( A*x > B(:,ones(1,size(x,2))) );

Contact us