Example:
a=
1 2 3
4 5 6
7 8 9
a=a(:)
->
a=
1
4
7
2
5
8
3
6
9
MATLAB applications, tutorials, examples, tricks, resources,...and a little bit of everything I learned ...
Thursday, July 23, 2009
Matlab: Remove all the unwatned elements in matrix
Today I just got a big set of data, the record of ozone level for one year. When the data is bad or there is no data for a certain point of time , they just use a 999. So I want to remover all of the 999s in this matrix.
If use Excel, that's easy- Find and Replace. In matlab, what I did is this:
Matrix=Matrix(Matrix ~=999)
Here's a simpler example:
If use Excel, that's easy- Find and Replace. In matlab, what I did is this:
Matrix=Matrix(Matrix ~=999)
Here's a simpler example:
a=[1 2 3 4 5 6 7 8 9 ];
b=a(a~=4);
->
b=[1 2 3 5 6 7 8 9]
Wednesday, July 15, 2009
Casio FX4500PA Calculator User Manual Download
I got a Casio fx4500PA calculator several years ago, but I just use it for the simplest calculation. And today I realized that it might be interesting if I do some more complicated job on this calculator. So I found this user manual and it can tell me how to do INTEGRATION and other programming on it. It's pretty cool.
Here's the link to download the user manual:
Casio FX4500PA Calculator User Manual Download
Here's the link to download the user manual:
Casio FX4500PA Calculator User Manual Download
Monday, July 6, 2009
Wednesday, July 1, 2009
Calculate Sequence and Sum
For a(1)=sqrt(2) and a(n+1)=sqrt(2+sqrt(n)), calculate the sequence and sum for n=10.
clc; clear all; close all;
format long;
a=[];
S=[];
a(1)=sqrt(2);
for k=2:11
a(k)=sqrt(2+a(k-1))
end
a=a';
for m=1:k
S(m)=sum(a(1:m));
end
clc; clear all; close all;
format long;
a=[];
S=[];
a(1)=sqrt(2);
for k=2:11
a(k)=sqrt(2+a(k-1))
end
a=a';
for m=1:k
S(m)=sum(a(1:m));
end
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);
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);
Subscribe to:
Posts (Atom)
my-alpine and docker-compose.yml
``` version: '1' services: man: build: . image: my-alpine:latest ``` Dockerfile: ``` FROM alpine:latest ENV PYTH...
-
It took me a while to figure out how to insert a space in Mathtype equations. This is especially useful when you write an equation with mult...
-
In this post, I am trying to solve the problem given in the comments of one of the old post. Here's the problem, if I understand it co...
-
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...