In: Computer Science
1) Write an algorithm (i.e. the series of steps) to find the
solution to a second order non-homogenous ODE (with boundary
conditions) using the method of undetermined coefficients. (Note:
this algorithm should include at least 1 control structure).
2) Write an if statement in MATLAB that converts an overall final
percentage mark grade (1-7).
Answer:
1) General approach to solve IInd order non-homogeneous ODE using the method of undetermined constants can be described in the following steps:
------------------------------------------------------
Let ODE be of the form:
ay''+by'+c = r(x)
where r(x) is finite linear combination of the form r(x) = r1(x) + r2(x) + --------------- + rn(x)
If ypi(x) is a solution to ay''+by'+c = ri(x) then
yp(x) = yp1(x) + yp2(x) + -----------------------+ ypn(x) is a solution to ay''+by'+c = r(x)
--------------------------------------------------------------
2) See the if statement below:
-------------------------------------------
if percentage >= 90
grade = 1;
elseif percentage >= 80 & percentage < 90
grade = 2;
elseif percentage >= 70 & percentage < 80
grade = 3;
elseif percentage >= 60 & percentage < 70
grade = 4;
elseif percentage >= 50 & percentage < 60
grade = 5;
elseif percentage >= 40 & percentage < 50
grade = 6;
else
grade = 7;
end
------------------------------------------