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 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

Sameer
Sameer il 10 Mar 2025
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!

Categorie

Scopri di più su Numerical Integration and Differential Equations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by