Wednesday, February 27, 2013

Set the properties of a dataset array in Matlab

The percent sign, %, can be used in the matlab code to add explanatory information to the code. Similarly, we can add explanatory information to a dataset array, by using the dataset array properties. The set function can be used to assign values to the dataset property, and the get function can be used to access these information.

DS=dataset(...) % a dataset array is constructed
DS=set(DS, 'Description', 'Whatever can describe the dataset can be put here');
get(DS) % show dataset array properties
summary(DS) % also show dataset array properties 

The 'Description' can be replaced with other properties which are displayed by the get function. 

Friday, February 22, 2013

Convert a dataset to matrix

For the simplest case when the dataset only contains numbers, this double function can be used to convert a dataset to matrix, or a vector if there is only one variable in the dataset:

m=double(ds)

Wednesday, January 9, 2013

Two useful Excel tricks

I was using Excel today and find that I need to do two things. The first one is to automatically alternate row colors (one shaded, one white), so I searched online and found this tutorial very useful.

http://www.techonthenet.com/excel/questions/cond_format2.php


And the other thing I would like to do is to create a list from data validation, so in each cell of one column, I can select the car makers. And I would like to use the next column to record the car model, which mean the second list is dependent on the selection of previous cell's input. I searched online and found that it is called : dependent list for data validation. Here's the tutorial that I followed:

http://www.contextures.com/xlDataVal02.html

Very helpful!

Saturday, November 24, 2012

Matlab surface fitting: why and how

Recently I come across a problem like this in my work:

Tow inputs, or say variables, determine the value of one output. z=f(x,y), but I am not sure what the function look like explicitly. So I did a lot of measurements and by the end I got three sets of data: 7 x values, 21 y values, and 147 corresponding z values. The surface fitting is the method that can help me find the explicit form of function z=f(x,y). And I used the Surface Fitting Tool in MATLAB to do this.

This tool has a very user-friendly interface, so not much explanation is needed here.
Screen shot of Surface Fitting Toll

Sunday, November 4, 2012

Link Exchange

This blog has ~5000 page views each month. I am more than happy to exchange links with you if you are the owner of a blog/website which focuses on the engineering, science, and technology.

Leave me a comment if you are interested and I will respond in a timely manner.

Friday, October 5, 2012

Matlab Statistic Tool Box regstats model trick

Just found this trick today.
When using:

regstats(y,x)

Matlab will use the linear model y=ax+b model to fit the data and calculate all relevant statistical parameters.

But sometimes we want to fix the trend line through zero, (0,0). In these case, this trick will help:

regstats(y,x,1)

Now Matlab will use the linear model y=ax model to fit the data and calculate all relevant statistical parameters.

Don't know why. But it is tested on R2010b version and confirmed by comparing with Excel calculation results.

my-alpine and docker-compose.yml

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