How to construct a symbolic pde that contains symbolic functions of certain variables (x & t)
9 次查看(过去 30 天)
显示 更早的评论
In the code seen below is an euler lagrange equation derivation for a cantilever beam, in the end solving for acceleration (typical system modelling stuff).
So far i have added actual functions for EIx(x) and mu(x), such as; EIx = ax+b where a and b are doubles/numbers.
Instead i would like to print the full symbolic equation, as seen below.
If i rewrite the first line as shown:
syms dw(x,t) w(x,t) w_xx(x,t) q(x,t) EIx(x,t) mu(x,t)
then the script will run. But when I write the EIx and mu as functions of x only, then errors that i do not understand occurs.
It is important in this context that matlab knows that EIx and mu is only functions of x, so that they will not be partially derived wrt. time.
Any ideas how to achieve this will be much appriciated.
%Blade params functions of x and t
syms dw(x,t) w(x,t) w_xx(x,t) q(x,t) EIx(x) mu(x)
%Lagrangian K - P + input*w
L = mu/2 * dw^2 - EIx/2 * w_xx^2 + q*w;
% img = imread('Eul_Lagr.PNG'); % Euler lagrange equation to be solved
% figure(1)
% image(img)
dL_dw = functionalDerivative(L,w); %term 1
dL_ddw = functionalDerivative(L,dw);
d_dL_ddw_dt = diff(dL_ddw,t); %term 2
dL_dw_xx = functionalDerivative(L,w_xx);
dL_dw_xx_dx1 = diff(dL_dw_xx,x);
dL_dw_xx_dx2 = diff(dL_dw_xx_dx1,x); %term 3
Eul_lagr = 0 == dL_dw - d_dL_ddw_dt + dL_dw_xx_dx2; %
w_xx1 = diff(w,x);
w_xx = diff(w_xx1,x);
Eul_lagr = subs(Eul_lagr); % Substituting wxx back
Eul_lagr = isolate(Eul_lagr, 'diff(dw(x, t), t)'); % Isolating acceleration
pretty(Eul_lagr)
0 个评论
采纳的回答
Abolfazl Chaman Motlagh
2022-7-1
you can write it this way:
%Blade params functions of x and t
syms dw(x,t) w(x,t) w_xx(x,t) q(x,t) EIx(x) mu(x)
%Lagrangian K - P + input*w
L(x,t) = mu(x)/2 * dw(x,t)^2 - EIx(x)/2 * w_xx(x,t)^2 + q(x,t)*w(x,t);
% img = imread('Eul_Lagr.PNG'); % Euler lagrange equation to be solved
% figure(1)
% image(img)
dL_dw = functionalDerivative(L,w); %term 1
dL_ddw = functionalDerivative(L,dw);
d_dL_ddw_dt = diff(dL_ddw,t); %term 2
dL_dw_xx = functionalDerivative(L,w_xx);
dL_dw_xx_dx1 = diff(dL_dw_xx,x);
dL_dw_xx_dx2 = diff(dL_dw_xx_dx1,x); %term 3
Eul_lagr = 0 == dL_dw - d_dL_ddw_dt + dL_dw_xx_dx2; %
w_xx1 = diff(w,x);
w_xx = diff(w_xx1,x);
Eul_lagr = subs(Eul_lagr); % Substituting wxx back
Eul_lagr = isolate(Eul_lagr, 'diff(dw(x, t), t)'); % Isolating acceleration
pretty(Eul_lagr)
or in the first case when you introduce Elx and mu as a function of x and t at the end add this:
Eul_lagr = subs(Eul_lagr,diff(mu(x, t), t),0);
Eul_lagr = subs(Eul_lagr,diff(Elx(x, t), t),0);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!