如何找到功能的关键点 - matlab

时间:2013-02-26 18:05:16

标签: matlab minimization

我知道这个问题已由user1003131发布并由Rody Oldenhuis回答

How to find critical points of function with exp in matlab

事情是,最终EitanT能够找到几个关键点,而user1003131只找到一个。

讨论的结束对于为什么会发生这种情况尚无定论。任何见解?

我的代码如下:

%% symbolic variables
syms w a l E I x;

%% equations
FIA=0;
THETAA=0;
MA=-((w*a)/(l^2))*((l-a)^2);
RA=(w/(l^3))*((l-a)^2)*(l+2*a);

%slope
HEAVISIDE_theta=(heaviside(x-a))*((x-a)^2);
theta=THETAA+((MA*x)/(E*I))+((RA*(x^2))/(2*E*I))-((w/(2*E*I))*HEAVISIDE_theta);

%deflection
HEAVISIDE_d=(heaviside(x-a))*((x-a)^3);
d=FIA+(THETAA*x)+((MA*(x^2))/(2*E*I))+((RA*(x^3))/(6*E*I))-((w/(6*E*I))*HEAVISIDE_d)

%% Partial differential equations
%slope
der_theta_x_2=(w*heaviside(x - a)*(2*a - 2*x))/(2*E*I) - (w*0*(a - x)^2)/(2*E*I) - (a*w*(a - l)^2)/(E*I*l^2) + (w*x*(a - l)^2*(2*a + l))/(E*I*l^3);
der_theta_a_2=(w*0*(a - x)^2)/(2*E*I) - (w*heaviside(x - a)*(2*a - 2*x))/(2*E*I) - (w*x*(a - l)^2)/(E*I*l^2) + (w*x^2*(a - l)^2)/(E*I*l^3) + (w*x^2*(2*a + l)*(2*a - 2*l))/(2*E*I*l^3) - (a*w*x*(2*a - 2*l))/(E*I*l^2);

%deflection
der_d_x_2=(w*0*(a - x)^3)/(6*E*I) - (w*heaviside(x - a)*(a - x)^2)/(2*E*I) + (w*x^2*(a - l)^2*(2*a + l))/(2*E*I*l^3) - (a*w*x*(a - l)^2)/(E*I*l^2);
der_d_a_2=(w*heaviside(x - a)*(a - x)^2)/(2*E*I) - (w*0*(a - x)^3)/(6*E*I) - (w*x^2*(a - l)^2)/(2*E*I*l^2) + (w*x^3*(a - l)^2)/(3*E*I*l^3) - (a*w*x^2*(2*a - 2*l))/(2*E*I*l^2) + (w*x^3*(2*a + l)*(2*a - 2*l))/(6*E*I*l^3);

%% define values
l=2;
I=4;
E=90000;
w=90;

%% replace symbols
theta=subs(theta);
d=subs(d);

der_theta_x_2=subs(der_theta_x_2);
der_theta_a_2=subs(der_theta_a_2);


der_d_x_2=subs(der_d_x_2);
der_d_a_2=subs(der_d_a_2);

%%   calculate critical points

[acr_theta, xcr_theta]=solve(der_theta_x_2, der_theta_a_2)
pcr_theta=double([acr_theta(:) xcr_theta(:)])


[acr_d, xcr_d]=solve(der_d_x_2==0,der_d_a_2==0, a, x)
pcr_d=double([acr_theta(:) xcr_theta(:)])

我会考虑通过使用最小化找到极端点,但由于存在重质素功能,我无法做到。

有什么建议吗?

由于

0 个答案:

没有答案