Instructions: Write the code of the given problems in the Script File of MATLAB and then copy the code on
the LMS assignment module directly. Also, copy the output of the program.
Question:
Solve the following differential equations using
1. ode45 command
2. dsolve command
Then plot the solutions from both commands in the same window by keeping the marker * (Asterisk) of
second curve.
Solution:
MTH643 Assignment 2 Solution
Solved By: Abdul Hadi E Services
clear all
close all
clc
eq1=@(t,y)-y+2*exp(2*t)*cos(t);
tlimit= [0,3];
y0=-5;
[t, y]=ode45(eq1, tlimit, y0);
plot(t,y)
hold on
syms y(t)
eq2=diff(y,t)==-y+2*exp(2*t) *cos(t);
cond=y(0)==-5;
ysol(t)=dsolve(eq2, cond);
Final=matlabFunction(ysol(t));
fplot(Final, tlimit,'*')
hold off
Download MTH643 Assignment in word
Want more info, please press the below button
`
0 Comments
Please write us. Please write in detail that how may we help you