This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f=isnan(lat); | |
lat(f)=[]; | |
lon(f)=[]; | |
maps(f)=[]; | |
prices(f)=[]; | |
f=find(lat>(mean(lat)+2*std(lat))); | |
lat(f)=[]; lon(f)=[]; maps(f)=[]; prices(f)=[]; | |
f=find(lat<(mean(lat)-2*std(lat))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iconStr = 'http://maps.google.com/mapfiles/kml/pal2/icon10.png'; | |
kmlStr=cell(1,length(maps)); | |
for i=1:length(maps) | |
kmlStr{i} = ge_point_new(lon(i),lat(i),0,... | |
'iconURL',iconStr,... | |
'iconColor','FF0080FF',... | |
'description',maps{i},... | |
'name',['$',num2str(prices(i))]); | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = urlread('http://flagstaff.craigslist.org/search/apa?query=&srchType=T&minAsk=500&maxAsk=1250&bedrooms=2&addThree=wooof&hasPic=1'); | |
% find the hyperlinks | |
ind=regexp(s,'href'); | |
useind=[]; | |
for k=1:length(ind) | |
if ~isempty(regexp(s(ind(k):ind(k)+100),'apa', 'once')) | |
useind=[useind;k]; | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filename=my_script.m; | |
cat > $filename << EOF | |
figure | |
plot(rand(1,10)) | |
print -dtiff test.tif | |
close | |
EOF | |
chmod +x $filename |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% P is a matrix of [x,y] points | |
P=[x,y]; | |
K = convhulln(P); | |
K = unique(K(:)); | |
PK = P(K,:)'; | |
[d N] = size(PK); | |
Q = zeros(d+1,N); | |
Q(1:d,:) = PK(1:d,1:N); | |
Q(d+1,:) = ones(1,N); | |
% initializations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fitellipse( x, **kwargs ): | |
x = asarray( x ) | |
## Parse inputs | |
## Default parameters | |
kwargs.setdefault( 'constraint', 'bookstein' ) | |
kwargs.setdefault( 'maxits', 200 ) | |
kwargs.setdefault( 'tol', 1e-5 ) | |
if x.shape[1] == 2: | |
x = x.T | |
centroid = mean(x, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#P is an array of points [x,y] | |
P=matrix(c(x,y),nc=2) | |
K=convhulln(Re(P), options="QJ") | |
K=sort(unique(c(K))) | |
PK = t(P[K,]) | |
d= dim(PK)[1] | |
N= dim(PK)[2] | |
Q = matrix(0,d+1,N)#create a matrix, with dim, filled with zeros. | |
Q[1:d,] = PK[1:d,1:N] | |
Q[d+1,] = matrix(1,N)# a matrix filled with ones. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [p,yhat] = lsq_fit_nonlin_force_thru_point(x,y,x0,y0,n); | |
x = x(:); %reshape the data into a column vector | |
y = y(:); | |
% 'C' is the Vandermonde matrix for 'x' | |
V(:,n+1) = ones(length(x),1,class(x)); | |
for j = n:-1:1 | |
V(:,j) = x.*V(:,j+1); | |
end | |
C = V; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [x,y,z] = csbinproc3d(xp, yp, zp, n) | |
x = zeros(n,1); | |
y = zeros(n,1); | |
z = zeros(n,1); | |
i = 1; | |
minx = min(xp); | |
maxx = max(xp); | |
miny = min(yp); | |
maxy = max(yp); | |
minz = min(zp); |