Archiv für August, 2009
Markus am 24.08.09 um 9:52 pm Uhr

Nice algorithm for the evaluation of step functions

Electrical engineering

Last week, I did measurements. And today, I tried to analyse those measurements. The problem: I recorded with a LDS - Nicolet system. And I used Perception for the evaluation. But the functions are quite limited. That’s what I think.

So I exported the recordings to ASCII. Which meant, I had 17 MB for each record. With 7.5 million samples each. And then I needed to find at which point, a step in the digital signal occured (High=10 Volts, Low=0.xxx V). So I imported the records in Scilab. Then I programmed some loops to run through all the records. It took Scilab 40 minutes. So obviously, there was room for improvement. What to do?

1. Create a vector, containing the analogue data of the more-or-less digital signal.
2. Create a second vector, comprising the same data
3. shift the second vector one row upwards
4. Subtract vector one from vector two
5. Divide the resulting vector by 10, and round it to integers
The result is a vector, which only contains -1 (down-step), 0 (no step), 1 (up-step).
6. Create a sparse-vector out of it.
7. Get all the values, which are in the original matrix, at the points of the sparse.

The result is: Instead of 40 minutes, the result was prepared within 10 seconds. But, you need to give Scilab a higher stacksize. By: stacksize(’max’)

If you want to have a look, you can download the file here.

Markus am 24.08.09 um 9:28 pm Uhr

MS word kills my nerves

Windows

First of all, it’s not that MS Word is not capable of doing all the things I need - but it’s soo complicated. It takes a lot of time to format the text. And to make sure, that word does not apply this special format to all headlines but only to this special one.
And, if you need to start a new numbering somewhere, e.g. for the appendixes - it takes time and nerves to make it work.

So, looking in the past, I must say, I am so happy for writing my diplom-thesis with LaTex. LaTex does not have a WYSIWYG (What you see, is what you get)-editor. But it’s more like: WYGIWYW - What you get, is what you want. It simply works, and always in a perfect quality.

I wonder, why engineers have to work with Word. Somehow engineering and word are something contrary…

Markus am 23.08.09 um 12:21 pm Uhr

NEMA - Standards, funny Americans

Electrical engineering

I don’t know, what NEMA-Standards are used for. But at least, it’s funny to read them.

See below.
Quotation: “It is not practical to build induction machines of all ratings and all speeds.”
I never would have guessed that.

Quotation: “At 50 hertz the speeds are 5/6 of the 60 hertz speeds.”
Good to know

Markus am 20.08.09 um 6:28 pm Uhr

Hot, hot, hot - it’s hoooot

Electrical engineering

Well, today, I was doing measurements in our lab. Our equipment is a measurement system, which is positioned above a pressure vessel, which has a temperature of 310°C. Now you can imagine, how I felt, when I stayed near the vessel for several hours…

Markus am 19.08.09 um 7:50 pm Uhr

FFT - Analysis with Scilab

Electrical engineering

The topic of the day was to perform a FFT - Fast Fourier Transformation. I used Scilab for doing this job, and in the following, I will describe how to do it.
Scilab is a great open source alternative to MatLab. It has a similar catalogue of features, and it is very easy to use (at least, if you know how to handle MatLab).

1. Get your measurement-data (ASCII-Format) into the right format. A dot has to be used as decimal separator. If it is a comma, you can change the comma to a dot easily.

2. Import your data into Scilab using this command
data=fscanfMat(’D:\yourlocation\test_fft.txt’)

3. Perform the FFT on channel 4 of your data (we assume, you have at least 4 channels in your data)
fft_daten=fft(data(:,4))

4. Get the number of samples
anzahl=size(data,1)

5. Evaluate the sampling rate
sample_rate=1/(data(2,1)-data(1,1))

6. Get the vector of your frequencies
f=sample_rate*(0:anzahl/2)/anzahl

7. Evaluate your amplitude spectrum
data_ampl=abs(fft_daten*2/anzahl)

8. Create the matrix of your results
result(:,1)=f’
result(:,2)=data_ampl(1:anzahl/2+1)

9. Plot your results
plot2d(result(:,1),result(:,2))

10. Save your results for further usage
fprintfMat(’D:\yourlocation\result.txt’,a)

Markus am 19.08.09 um 7:35 pm Uhr

Replacing a comma by a dot and vice versa in ASCII-Files

Linux Tools, Windows

Sometimes, there is the need of changing a dot to a comma and vice versa. This occurs, for example, in measurement data, which are in ASCII-format.

With Linux, this is easy, but how can you achieve that under Windows (what still most professional companies are using)?

Well, use Notepad. But in larger files, this takes a while. (In my particular case, it took 15 minutes for one file.)

So, the easiest way is to use sed. Sed is also available for Windows, it comes with the Gnuwin32-package. With it, you can easily do every modification on text-files, that you can imagine.

For a replacement of a comma by a dot, use sed in this way:

D:\path_to_your_location\sed -i~ “s/\,/\./g” testfile.txt

It does the following:
1. It saves the original file under the same name followed by ~ (in this case: testfile.txt~)
2. it changes the comma by a dot
3. it does this on all occurances of a comma within this file.