# Blog

## fast calculation of functions with two variables

Gepostet von am Mai 31, 2011 in matlab, Programming | Keine Kommentare

If you come from the programming world of C/C++ or java or any other traditional programming languages you might fall into the trap of using for loops for the calculation of functions. This works as expected but it is much slower than what matlab can do. The following example demonstrates this principle (which you should not use if you can) Data2D = zeros([xPoints yPoints]); for xi = 1:xPoints x = xAxis(xi); for yi = 1:yPoints y = yAxis(yi); Data2D(xi,yi) = Ripple(x, y); end endData2D =...

## plotting a filled curve

Gepostet von am Mai 31, 2011 in matlab, Programming | Keine Kommentare

A search on how to fill the area under a curve reveals that such questions are quite often asked. Here is the solution in a function file that I created for simplifying filled curve plots using matlabs fill function. function handle = filledcurve(x, y, zero, colorspec)   if (nargin < 3) zero = 0; end   if (nargin < 4) colorspec = 'b'; end     xtemp = [x(1) ; x(:) ; x(end)] ; ytemp = [zero ; y(:) ; zero ] ;   % plot handle =...

## fast reading of structured text data with matlab

Gepostet von am Mai 31, 2011 in matlab, Programming | Keine Kommentare

In the following I present a solution to read data from a textfile which has the number of x-values (columns) in the first line, the number of y-values (rows) in the second line and in all following lines the matrix with size x times y. The principle reading of the data is achieved by the following code % open file display(['reading ' FILENAME]); fid = fopen(FILENAME, 'r'); fseek(fid, 0, 'bof');   % read single line: number of x-values tline = fgetl(fid); valueLine = strrep(tline, '#', '');...

## LaTeX-Vorlage für Protokolle

Gepostet von am Mai 15, 2011 in LaTeX | Keine Kommentare

Neue LaTeX-Vorlage zur Erstellung von Labor-Protokollen:   LaTeXTemplateProtokoll (505,4 KiB) Die Vorlage beruht auf Koma Script (scrartcl) und ist für pdflatex ausgelegt (kein LuaTeX oder XeteX). Unter anderem werden diese Pakete verwendet: inputenc, grffile, fontenc, textcomp, lmodern, babel, xcolor, graphicx, epstopdf, caption, amsmath, siunitx, booktabs, tabularx, setspace, scrpage2, microtype. Anpassungen im Layout wurden mit koma script Optionen sowie den Einstellungsmöglichkeiten der Pakete caption und scrpage2...

## LaTeX Einführung

Gepostet von am Mai 15, 2011 in LaTeX | Keine Kommentare

Im Rahmen eines Workshops der jDPG Hannover wurde der folgende Vortrag zur Einführung in LaTeX gehalten:   LaTeXIntroductionVortrag-2011-05-14.pdf (1,6 MiB)   LaTeXIntroductionHandout-2011-05-14.pdf (1,4 MiB)   Uebungen-2011-05-14.zip (569,9 KiB) Das Publikum bestand aus Physik-Studenten des 2ten Semesters. Der Vortrag und die dazu abgehaltenen Übungen umfassten 4 Stunden. Dieser Zeitraum reichte aus, um grundlegende Konzepte zu erklären, allerdings nicht um alle benötigten Inhalte zum...

## plotting tutorials

Gepostet von am Dez 16, 2010 in matlab | Keine Kommentare

Here are some tutorials about plotting in matlab. (all original links except this are unfortunately dead): making pretty graphs

## batch script for automatic backup using winrar

Gepostet von am Okt 24, 2010 in batch | Keine Kommentare

For a regular full backup of all my important data I am using a bash script on Linux. This is now an example to achieve the same under Windows 7 using batch scripting and winrar as the compressor. Zip files can not be used since this is limited in total number of files which I typically overcome. @ECHO OFF cls ::------------------------------------------------------------------------------------- SET PACKER="c:\Program Files\WinRAR\RAR.exe" :: %APPDATA% = "C:\Users\Matthias\AppData\Roaming" :: %USERNAME% =...

## Matlab figures – solving export problems

Gepostet von am Okt 11, 2010 in matlab | 18 Kommentare

How to make a really beautiful and publishable graph with matlab is not easy but possible. It is very good descriped in this article making pretty graphs. However once you want to export your file you run into many problems, which are build in bugs of matlab, and have not been fixed since years. They are however well documented by matlab… The two most important bugs are the missing font support and wrong linestyles. If you use any not standard postscript font such as „Times, Helvetica, Courier, Bookman“ then the font gets...

## C++ Vortrag: Grundlagen und Objektorientierte Programmierung 2

Gepostet von am Sep 7, 2010 in C++ | 1 Kommentar

Erneut werde ich einen Workshop über C++ halten. Diesmal habe ich die Grundlagen kurz gehalten und gehe dafür detailierter auf Klassen und Objektorientierte Programmierung ein. Das ganze umfasse 2 Stunden. Dabei werden ein paar praktische Übungen durchgeführt. Zielpublikum sind Masterstudenten und Doktoranden aus der Physik mit grundlegenden C/C++ Kentnissen – wobei Kentnissen in objektorientierter Programmierung eher wenig vorhanden sind.   VortragCpp2010.pdf (540,6...