clc; clear; close all; % Balkenlänge und Materialkonstanten setzen L = 1; % normierte Balkenlänge E = 1; % Normierung I = 1; % Normierung % Erstelle GUI mit Schieberegler und Eingabefeld fig = figure('Name', 'Balken Biegelinie', 'NumberTitle', 'off', 'Position', [100, 100, 800, 800]); % Erstelle Achsen für Plot ax1 = subplot(4,1,1); ax2 = subplot(4,1,2); ax3 = subplot(4,1,3); ax4 = subplot(4,1,4); % Schieberegler unter dem Plot uicontrol('Style', 'text', 'Position', [320, 60, 160, 20], 'String', 'Lagerposition Z'); slider = uicontrol('Style', 'slider', 'Min', 0.01, 'Max', 0.49, 'Value', 0.2, 'Position', [250, 40, 300, 20]); editBox = uicontrol('Style', 'edit', 'Position', [360, 10, 80, 20], 'String', num2str(slider.Value)); % Callback-Funktion für den Schieberegler slider.Callback = @(src, event) updatePlot(src.Value, editBox, ax1, ax2, ax3, ax4); editBox.Callback = @(src, event) updatePlot(str2double(src.String), slider, ax1, ax2, ax3, ax4); % Initiale Darstellung updatePlot(slider.Value, editBox, ax1, ax2, ax3, ax4); function updatePlot(Z, control, ax1, ax2, ax3, ax4) if Z < 0.01 || Z > 0.49 return; end % Aktualisiere Schieberegler oder Editbox if isa(control, 'matlab.ui.control.UIControl') && strcmp(control.Style, 'edit') control.String = num2str(Z); elseif isa(control, 'matlab.ui.control.UIControl') && strcmp(control.Style, 'slider') control.Value = Z; end % Berechnung der Konstanten C1 = 1 - 6 * Z * (1 - Z); C2 = 6 * Z^2 * (1 - Z) - Z * (1 + Z^3); C3 = 1 - 6 * Z; C4 = 6 * Z^2 * (1 - Z) - Z * (1 + Z^3) + 2 * Z^3; C5 = 6 * Z * (1 - Z) - 5; C6 = Z^3 * (1 - Z) + 7 * Z^2 * (1 - Z) - 5 * Z * (1 - Z) + 2 * (1 - Z); % Diskretisierung des Balkens x1 = linspace(0, Z, 50); x2 = linspace(Z, 1-Z, 50); x3 = linspace(1-Z, 1, 50); % Biegelinien in den drei Bereichen w1 = (x1.^4) + C1 * x1 + C2; w2 = (x2.^4) - 2 * x2.^3 + 6 * Z * x2.^2 + C3 * x2 + C4; w3 = (x3.^4) - 4 * x3.^3 + 6 * x3.^2 + C5 * x3 + C6; % Ableitungen berechnen dw1 = 4*x1.^3 + C1; dw2 = 4*x2.^3 - 6*x2.^2 + 12*Z*x2 + C3; dw3 = 4*x3.^3 - 12*x3.^2 + 12*x3 + C5; d2w1 = 12*x1.^2; d2w2 = 12*x2.^2 - 12*x2 + 12*Z; d2w3 = 12*x3.^2 - 24*x3 + 12; d3w1 = 24*x1; d3w2 = 24*x2 - 12; d3w3 = 24*x3 - 24; % Aktualisiere Plots cla(ax1); hold(ax1, 'on'); plot(ax1, [x1, x2, x3], [w1, w2, w3], 'LineWidth', 2); title(ax1, 'Biegelinie w(x)'); grid(ax1, 'on'); cla(ax2); hold(ax2, 'on'); plot(ax2, [x1, x2, x3], [dw1, dw2, dw3], 'LineWidth', 2); title(ax2, 'Verdrehung w''(x)'); grid(ax2, 'on'); cla(ax3); hold(ax3, 'on'); plot(ax3, [x1, x2, x3], [d2w1, d2w2, d2w3], 'LineWidth', 2); title(ax3, 'Biegemoment w''''(x)'); grid(ax3, 'on'); cla(ax4); hold(ax4, 'on'); plot(ax4, [x1, x2, x3], [d3w1, d3w2, d3w3], 'LineWidth', 2); title(ax4, 'Querkraft w''''''(x)'); grid(ax4, 'on'); hold off; end