How do i solve a non homogenous diff equation without dsolve? I have done the code for the complimentary function pls help me with the particular solution part

조회 수: 2 (최근 30일)
clc
syms t m k1 k2
a=input(' Enter the coefficient of D2y:');
b=input(' Enter the coefficient of Dy:');
c=input(' Enter the coeeficent of y:');
cq=a*m^2+b*m+c;
r=solve(cq)
if imag(r)~=0
disp('under damping')
y1=exp(real(r(1))*t)*cos(imag(r(1))*t);
y2=exp(real(r(1))*t)*sin(abs(imag(r(1)))*t);
elseif r(1)==r(2)
disp('Critical damping:')
y1=exp(r(1)*t);y2=t*exp(r(1)*t);
else
disp('over damping:')
y1=exp(r(1)*t);
y2=exp(r(2)*t);
end
disp(' The complimentary sol y_c is:')y_c=k1*y1+k2*y2

답변 (1개)

Sameer
Sameer 2025년 3월 10일
To find the particular solution of a non-homogeneous differential equation, you can use methods such as the method of undetermined coefficients or the method of variation of parameters.
1. Method of Undetermined Coefficients:
  • Guess a form for the particular solution based on the non-homogeneous term.
  • Substitute this guess into the differential equation to find unknown coefficients.
2. Method of Variation of Parameters:
  • Use the complementary solution to construct a particular solution.
  • Calculate specific integrals to find the parameters.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by