Question: Matlab code question I pasted the code below, just below the picture I show here. How were the equations under the gradg(:,1), gradg(:,2) ... found?
Matlab code question I pasted the code below, just below the picture I show here. How were the equations under the gradg(:,1), gradg(:,2) ... found? Are they second derivates?

syms x1 x2
E = 75e6;
h = 4;
H = 20;
b = 8;
P = .8;
w = 2.5;
rho=2700;
F = P*b*h;
W = w*b*h;
A=0.25*pi*(x1^2-(x1-2*x2)^2);
I=(pi/64)*(x1^4-(x1-2*x2)^4);
sigma=(F/(E*I))*(((H^3)/3)+((H^2*h)/2)+((H*h^2)/4)); %deformation
M=W*sigma;
fa=W/A;
fa_limit=300e6;
fb=(M*x1)/(2*I);
fb_limit=140e6;
mass=A*H*rho;
g_1=(fa/fa_limit)-1;
g_2=(fb/fb_limit)-1;
g_3=(sigma/0.1)-1;
g_4=(x1/2.5)-1;
g_5=(0.1/x1)-1;
g_6=(x2/0.1)-1;
g_7=(0.0005/x2)-1;
g_8=(x1/(x2*92))-1
grad_g1=([diff(g_1,x1);diff(g_1,x2)])
grad_g2=([diff(g_2,x1);diff(g_2,x2)])
grad_g3=([diff(g_3,x1);diff(g_3,x2)])
grad_g4=([diff(g_4,x1);diff(g_4,x2)])
grad_g5=([diff(g_5,x1);diff(g_5,x2)])
grad_g6=([diff(g_6,x1);diff(g_6,x2)])
grad_g7=([diff(g_7,x1);diff(g_7,x2)])
grad_g8=([diff(g_8,x1);diff(g_8,x2)])
function [g,h, gradg , gradh] E=75e6; %kpa h = 4; H 20; const (x) = w = 2.5; rho-2700 F=P*b*h; kn/m^2 kn/m^2 % kg/m^3 %wind force w*bh weight A=0.25"pi* (x (1) rg. (x(1)-2% (2)) ^2) ; %deformation sigma= (F/ (E*1)) * ( ( (H^ 3) /3) + ( (H"2th)/2) + ( (e*h"2) /4)) ; M=W" sigma ; fa-W/A fa limit=300e6; smoment at base %axial stress %bending stress fb limit=140e6; mass-AH*rho; sconstraint g(1)=(fa/ falimit)-1; g (2)=(fb/fb-limit)-1; g(3)=(sigma/0.1)-1 ; %% \% %% axial load smaller than 300e6 Pa bending smaller than 140e5 Pa de formation smaller than 0.1 m - h= [ ]; if nargout > 2 gradg(: ,1) [ 0.019634 95408* (x (1) -0.03926990817* (x (1) -2.0*x (2))3 = 2.0*x (2))^3-0. 01963495408*x(1)"3; _ gradg ( : , 2) gradg(:, 3) [-942477.7961*x (2); 1884955.592 *x (2) -942477.7961*x (1)]; [0.04842382222-674.6799884*( (x(1) -2.0*x(2))"4- = 1.0*x 1)4)(4.0* (x (1) - 2.0*x (2))3- 4.0x) 3) 5397.439907*(x(1) - 2.0*x (2))4 -1.0*x (1) 4)(x (1) -2.0x (2)) 3] gradh = [ ] ; end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
