symbolic code with boundary condition

2 ビュー (過去 30 日間)
MINATI
MINATI 2019 年 12 月 29 日
コメント済み: MINATI 2019 年 12 月 29 日
t = sym('t'); x = sym('x');
a=5;a1=2;xa=0;xb=3;
g = zeros(1,3,'sym');ga = zeros(1,3,'sym');g(1)=a*x+(5/2)*x.^2;
for i=1:3
ga(i) = subs(g(i),x,t);dga = diff(ga(i),t,1);d2ga = diff(dga,t,1);
Ig1 = int(-ga(i)*d2ga + 2*dga,t,0,t);Ig2=int(Ig1,t,0,t);Ig3=int(Ig2,t,0,x);
g(i+1) = a1*Ig3;
% % disp(g(i+1))
end
g = g(1)+g(2)+g(3)+g(4);
G1 = double(subs(g, x, xn));G2 = [a diff(double(subs(g,x,xn)))];
xn=linspace(xa,xb,100);x = xn;
figure(1)
plot(xn,G1,'LineWidth',1.5)
xlabel('\bf\eta'); ylabel('\bfg(\eta)');
hold on
figure(2)
plot(xn,G2,'LineWidth',1.5)
xlabel('\bf\eta'); ylabel('\bfg^''(\eta)');
hold on
%% G1 should start from '1' and G2 from 'a' end with '0' (in Y-axis)
what modification needed?
  3 件のコメント
MINATI PATRA
MINATI PATRA 2019 年 12 月 29 日
It is defined as linspace in the code
MINATI
MINATI 2019 年 12 月 29 日
G1(0)=0;G2(0)=a;G2(inf)=0;

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by