I need to create a cicle in which, for a specific value, it solves one set of equation or another. It doesn't compute.

8 views (last 30 days)
Lcz = 10; %Contact lenght [mm]
delta0 = 25; %Softening Lenght [mm]
delta_c = 50; %Decohesion Lenght [mm]
sigma0 = 120; %Softening Tension [MPa]
E = 70000; %Young's Modulus [MPa]
h = 6; %Section Height [mm]
b = 25; %Section Width [mm]
I = (Lcz*h^3)/12; %Inertia Momentum [mm^4]
L = 200; %Beam Lenght [mm]
l == (L-Lcz); %Crack Tip [mm]
Unrecognized function or variable 'l'.
P = 100; %Shear Force at the tip [N]
A = (2*Lcz*sigma0)/(E*I*delta0);
B = -(2*Lcz*sigma0)/(E*I*(delta_c-delta0));
D = (Lcz*sigma0*delta_c)/(E*I*(delta_c-delta0));
syms v(s)
for delta = 40
if delta <= delta0
c1 = v(0) == 0;
v1 = diff(v,s);
v2 = diff(v,s,2);
v3 = diff(v,s,3);
c2 = v1(0) == 0;
c3 = v(l) == delta0/2;
c4 = v1(l) == 0;
v(s) = dsolve(diff(v,s,4) == -A*v,c1,c2,c3,c4);
elseif (delta > delta0) && (delta <= delta_c)
c1 = v(0) == 0;
v1 = diff(v,s);
v2 = diff(v,s,2);
v3 = diff(v,s,3);
c2 = v1(0) == 0;
c3 = v(l) == delta0/2;
c4 = v1(l) == 0;
v(s) = dsolve(diff(v,s,4) == (-D-B*v),c1,c2,c3,c4);
end
end
s = [0:10:L];
displacements = v(s)/(E*I)
fplot(s,displacements,"b -o");
xlabel('Beam Position');
ylabel('Displacements');

Accepted Answer

Torsten
Torsten on 2 Mar 2025
Edited: Torsten on 2 Mar 2025
Works for me. Maybe you use an older MATLAB release ?
Lcz = 10; %Contact lenght [mm]
delta0 = 25; %Softening Lenght [mm]
delta_c = 50; %Decohesion Lenght [mm]
sigma0 = 120; %Softening Tension [MPa]
E = 70000; %Young's Modulus [MPa]
h = 6; %Section Height [mm]
b = 25; %Section Width [mm]
I = (Lcz*h^3)/12; %Inertia Momentum [mm^4]
L = 200; %Beam Lenght [mm]
l = (L-Lcz); %Crack Tip [mm]
P = 100; %Shear Force at the tip [N]
A = (2*Lcz*sigma0)/(E*I*delta0);
B = -(2*Lcz*sigma0)/(E*I*(delta_c-delta0));
D = (Lcz*sigma0*delta_c)/(E*I*(delta_c-delta0));
syms v(s)
for delta = 40
if delta <= delta0
c1 = v(0) == 0;
v1 = diff(v,s);
v2 = diff(v,s,2);
v3 = diff(v,s,3);
c2 = v1(0) == 0;
c3 = v(l) == delta0/2;
c4 = v1(l) == 0;
v(s) = dsolve(diff(v,s,4) == -A*v,c1,c2,c3,c4);
elseif (delta > delta0) && (delta <= delta_c)
c1 = v(0) == 0;
v1 = diff(v,s);
v2 = diff(v,s,2);
v3 = diff(v,s,3);
c2 = v1(0) == 0;
c3 = v(l) == delta0/2;
c4 = v1(l) == 0;
v(s) = dsolve(diff(v,s,4) == (-D-B*v),c1,c2,c3,c4);
end
end
figure(1)
displacements = v/(E*I);
fplot(displacements,[0 L])
xlabel('Beam Position');
ylabel('Displacements');
figure(2)
displacements = matlabFunction(v/(E*I));
s = 0:10:L;
plot(s,displacements(s),'b -o')
xlabel('Beam Position');
ylabel('Displacements');
  4 Comments
Torsten
Torsten on 3 Mar 2025
l = (L-Lcz); %Crack Tip [mm]
fplot(displacements,[0 L])
instead of
l == (L-Lcz); %Crack Tip [mm]
fplot(s,displacements,"b -o");

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!