MATLAB’s differential equations solver dsolve provides symbolic solutions to fir
ID: 3822621 • Letter: M
Question
MATLAB’s differential equations solver dsolve provides symbolic solutions to first-order differential equations, although they are not always explicit solutions.
7. Solve the following IVP and plot solutions curves for different initial conditions dy IVP dt Sc dsolve Dyet 3+y y(0) c', t') If we wish to plot the solutions curves with initial values y(0) S7, 7.5, 8, 8.5on the interval [0, 1] create a vector starting at 7 and ending at 8.5, with a for cs 7:0.5:8.5 step size of 0.5 Scs subs (Sc c', cs); ezplot(Scs, [0, 1]) hold on end hold off axis 1, 0, 25]) lgd legend 7', 7.5', 8', 8 5', Location southeast title (lgd, 'Initial ConditionsExplanation / Answer
% Use Anonymous Function
fun=@(y,t)(t^3 + y)
% Call Solver With Anonymous Function Name,
for i = 7.0 : 0.5 : 8.5
[y,t]=ode45(fun,[0:0.1:1],i);
% Plotting Segment
plot(y,t,'Linewidth',2)
xlabel('y'),ylabel('t'),grid on
title('Solution to dy/dx = (t^3 + y)’)
end;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.