12.02.2014 Aufrufe

Mathematik für Physiker - Numerische Physik: Modellierung

Mathematik für Physiker - Numerische Physik: Modellierung

Mathematik für Physiker - Numerische Physik: Modellierung

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

B.6. MATLAB SKIPTE, FUNKTIONEN UND GUIS: QUELLCODE 503<br />

B.6.2<br />

GUI num int<br />

Einfaches GUI zur numerischen Integration. Die benötigten Dateien sind<br />

1. Main: num int<br />

2. Sub: setintegration<br />

3. Funktionen:<br />

(a) mittelgui,<br />

(b) simpsongui,<br />

(c) trapezgui.<br />

Main: num int<br />

%num_int<br />

%numerische Integration einer Funktion<br />

%Eingabe: Funktion<br />

% x-Start, untere Grenze des Integrtionsintervalls<br />

% x-Ende, obere Grenze des Integraionsintervalls<br />

%PopUp-Menu: Integrationsverfahren<br />

%Ausgabe: Funktionsplot und Ergebnis<br />

clear<br />

figure( ...<br />

’Name’,’<strong>Numerische</strong> Integration’, ...<br />

’NumberTitle’,’off’);<br />

axes( ...<br />

’Units’,’normalized’, ...<br />

’Position’,[0.10 0.12 0.6 0.78], ...<br />

’FontUnits’,’Normalized’,’FontSize’,0.055);<br />

Pos = [0.75 0.8 0.2 0.05];<br />

Poshalbe = [0.75 0.8 0.1 0.05];<br />

dPos = [0 -0.1 0 0];<br />

dxPos = [0.1 0 0 0];<br />

a=0;b=pi;M=10;<br />

hText = uicontrol( ...<br />

’Style’,’edit’, ...<br />

’Units’,’normalized’, ...<br />

’Position’,Pos-0.5*dPos, ...<br />

’BackgroundColor’,[1 1 1], ...<br />

’String’,’sin(x)’);<br />

uicontrol( ...<br />

’Style’,’text’, ...<br />

’Units’,’normalized’, ...<br />

’BackgroundColor’,[1 1 1], ...<br />

’Position’,Pos+0.5*dPos, ...<br />

’HorizontalAlignment’,’left’, ...<br />

’String’,’x-Start’);<br />

xcb = [...<br />

’a = str2num(get(hxrange,’’String’’));’];<br />

hxrange = uicontrol( ...<br />

’Style’,’edit’, ...<br />

’Units’,’normalized’, ...<br />

’Position’,Poshalbe+0.5*dPos+1*dxPos, ...<br />

’BackgroundColor’,[1 1 1], ...<br />

’String’,’0’, ...<br />

’Callback’,xcb);<br />

uicontrol( ...<br />

’Style’,’text’, ...<br />

’Units’,’normalized’, ...<br />

’BackgroundColor’,[1 1 1], ...<br />

’Position’,Pos+1.5*dPos, ...<br />

’HorizontalAlignment’,’left’, ...<br />

’String’,’x-Stop’);<br />

ycb = [...<br />

’b = str2num(get(hyrange,’’String’’));’];<br />

hyrange = uicontrol( ...<br />

c○ M.-B. Kallenrode 13. März 2007

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!