Skip to content

Instantly share code, notes, and snippets.

@iamhatesz
Created January 13, 2017 11:06
Show Gist options
  • Save iamhatesz/387ab968225da64813246f0c17d602e8 to your computer and use it in GitHub Desktop.
Save iamhatesz/387ab968225da64813246f0c17d602e8 to your computer and use it in GitHub Desktop.
clc
clear all
close all
syms x A E real;
p = [1 x];
xs = [0 1.5 2.1 3.14];
n = length(xs);
Kg = zeros(4, 4)
for i = 1:n-1
Me = [1 xs(i); 1 xs(i+1)];
L = det(Me);
N = p * inv(Me);
Be = diff(N, x);
K = L * Be' * A * E * Be;
Kl = sym(zeros(4, 4));
Kl(i, i) = K(1, 1);
Kl(i, i+1) = K(1, 2);
Kl(i+1, i) = K(2, 1);
Kl(i+1, i+1) = K(2, 2);
Kl
% agregacja
Kg = Kg + Kl;
end
Kg
% utwierdzenie pierwszego węzła
Kg_utw = Kg(2:end, 2:end)
% wymuszenia
F = [10; 20; 0];
% odkształcenia w węzłach
X = inv(Kg_utw) * F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment