Tuesday, June 30, 2009

3rd Movie

Well, this time I wrote the code by myself.

clc; clear all; close all;
Fig=figure;
aviobj=avifile('sphere.avi');

for k=1:6
n=2^k-1;
[x y z]=sphere(n);
c = hadamard(2^k);
surf(x, y, z, c)
colormap([1 1 0; 0 1 1]);
axis off; axis equal;
F=getframe(Fig);
for m=1:15
aviobj=addframe(aviobj, F);
end
end
for k=5:-1:1
n=2^k-1;
[x y z]=sphere(n);
c = hadamard(2^k);
surf(x, y, z, c)
colormap([1 1 0; 0 1 1]);
axis off; axis equal;
F=getframe(Fig);
for m=1:15
aviobj=addframe(aviobj, F);
end
end
close(Fig)
aviobj = close(aviobj);


Another avi 'Movie' by avifile function

Saturday, June 27, 2009

Pictures of magic matrix (50x50)

Plotmatrix: This one is 5x5
area:

bar:

comet:

compass:

contour:

contourf:

image:

imagesc:

loglog:

mesh:

pcolor:

plot:

polar:

ribbon:

semilogx

semilogy

spy

stairs

stem3

stem

surf

Friday, June 26, 2009

avi 'Movie' created by avifile function

The code used to create this 'movie':


t = linspace(0,2.5*pi,40);
fact = 10*sin(t);fig=figure;aviobj = avifile('example.avi')
[x,y,z] = peaks;
for k=1:length(fact) 
h = surf(x,y,fact(k)*z);
axis([-3 3 -3 3 -80 80]) 
axis off 
caxis([-90 90]) 
F = getframe(fig);
aviobj = addframe(aviobj,F);
endclose(fig)aviobj = close(aviobj);
 
The code above was copied from HERE .


Sunday, June 21, 2009

Tracking Code


Matlab: Remove the NaN elements

Recently I got a very long column of data and it contains lots of NaN. I found the finite function very useful to help me remove all the NaN elements. Also it can remove the Inf elements. For example:
C1=[0 1 2 3 NaN 4 5 6 NaN 7 Inf 8 Inf 9];
C2=C1(finite(C1));

we get :
C2=[0 1 2 3 4 5 6 7 8 9]

I'm using R2008a version and I got a warning like this:
Warning: FINITE is obsolete and will be removed in future versions. Use ISFINITE instead.

Thursday, June 18, 2009

xlsread

Today I wrote a small piece to read data from xls files. Each file has several sheets and I only need one single column from each sheet. And at the end, I concatenated the columns to make a very very long colmn.

clc; clear all; close all;
O51=xlsread('TX2005.xls',1,'E1:E8760');
O52=xlsread('TX2005.xls',2,'E1:E8760');
O53=xlsread('TX2005.xls',3,'E1:E8760');
O54=xlsread('TX2005.xls',4,'E1:E8760');
O55=xlsread('TX2005.xls',5,'E1:E8760');
% O56=xlsread('NJ2005.xls',6,'E1:E8760');
% O57=xlsread('NJ2005.xls',7,'E1:E8760');
% O58=xlsread('NJ2005.xls',8,'E1:E8760');
O61=xlsread('TX2006.xls',1,'E1:E8760');
O62=xlsread('TX2006.xls',2,'E1:E8760');
O63=xlsread('TX2006.xls',3,'E1:E8760');
O64=xlsread('TX2006.xls',4,'E1:E8760');
O65=xlsread('TX2006.xls',5,'E1:E8760');
O66=xlsread('TX2006.xls',6,'E1:E8760');
O67=xlsread('TX2006.xls',7,'E1:E8760');
O68=xlsread('TX2006.xls',7,'E1:E8760');
O69=xlsread('TX2006.xls',7,'E1:E8760');
O71=xlsread('TX2007.xls',1,'E1:E8760');
O72=xlsread('TX2007.xls',2,'E1:E8760');
O73=xlsread('TX2007.xls',3,'E1:E8760');
O74=xlsread('TX2007.xls',4,'E1:E8760');
O75=xlsread('TX2007.xls',5,'E1:E8760');
O76=xlsread('TX2007.xls',6,'E1:E8760');
O77=xlsread('TX2007.xls',7,'E1:E8760');
O78=xlsread('TX2007.xls',4,'E1:E8760');
O79=xlsread('TX2007.xls',5,'E1:E8760');
O710=xlsread('TX2007.xls',6,'E1:E8760');
O711=xlsread('TX2007.xls',7,'E1:E8760');
O712=xlsread('TX2007.xls',7,'E1:E8760');
TXHourly=[O51;O52;O53;O54;O55;O61;O62;O63;O64;O65;O66;O67;O68;O69;O71;O72;O73;O74;O75;O76;O77;O78;O79;O710;O711;O712];

my-alpine and docker-compose.yml

 ``` version: '1' services:     man:       build: .       image: my-alpine:latest   ```  Dockerfile: ``` FROM alpine:latest ENV PYTH...