Exercise 1)
Code:
%Exercise 1
syms y(t)
ode = diff(y,t)==t*y;
%Showing this output
ySol(t)= dsolve(ode)
%Using boundary condition
cond = y(0)==2;
%Showing this output
ySol(t)= dsolve(ode,cond)
%Plting on a interval of [-3,+3]
fplot(ySol,[-3,3]);
PLOT:
Exercise 2) :
Code:
%Exercise 2
syms y(t)
ode = (diff(y,t)+y)^2==1;
%Using boundary condition
cond = y(0)==0;
%Showing this output
ySol(t)= dsolve(ode,cond)
%Plting on a interval of [-6,+10]
fplot(ySol,[-6,10]);
Plot:
Exercise 2) :
Code:
Plot:
Exercise 3) :
Code:
%Exercise 3
syms y(x)
%1st Differential
Dy = diff(y);
%original equation
ode = diff(y,x,2)==cos(2*x)-y;
%Using boundary condition
cond1 = y(0)==1;
cond2 = Dy(0)==0;
conds = [cond1,cond2];
%Solving equation using 'conds' as condition
ySol(x)= dsolve(ode,conds)
ySol = simplify(ySol)
%Polting on an assumed interval of [-6,+10]
fplot(ySol,[-6,10]);
Plot:
Exercise 4) :
Solution 1
uSol(t) =
C10*cos(4*t)*exp(3*t) + C9*sin(4*t)*exp(3*t)
vSol(t) =
C9*cos(4*t)*exp(3*t) - C10*sin(4*t)*exp(3*t)
Code:
%Exercise 4
syms u(t) v(t)
%1st Differential
ode1 = diff(u)==3*u+4*v;
%2nd Differential
ode2 = diff(v) == -4*u+3*v;
%original equation
odes = [ode1,ode2];
%Solving Without boundary condition
[uSol(t),vSol(t)]=dsolve(odes)
%Using boundary condition
cond1 = u(0)==0;
cond2 = v(0)==1;
conds = [cond1,cond2];
%Solving equation using 'conds' as condition
[uSol(t),vSol(t)]= dsolve(odes,conds)
%Polting with default range
fplot(uSol);
hold on
fplot(vSol);
grid on
legend('uSol','vSol','Location','best')
Plot:
Problem 1) :
Solution:
ySol(x) =
(5*cos(x))/3 + sin(x)*(sin(3*x)/6 + sin(x)/2) -
(2*cos(x)*(6*tan(x/2)^2 - 3*tan(x/2)^4 + 1))/(3*(tan(x/2)^2 + 1)^3)
- (sin(x)*(6*cos(2) + 9*sin(2)^2*tan(1)^2 + 9*sin(2)^2*tan(1)^4 +
3*sin(2)^2*tan(1)^6 + sin(2)*sin(6) + 6*cos(2)*tan(1)^2 +
42*cos(2)*tan(1)^4 + 10*cos(2)*tan(1)^6 + 3*sin(2)^2 - 90*tan(1)^2
- 90*tan(1)^4 - 30*tan(1)^6 + 3*sin(2)*sin(6)*tan(1)^2 +
3*sin(2)*sin(6)*tan(1)^4 + sin(2)*sin(6)*tan(1)^6 -
30))/(6*sin(2)*(tan(1)^2 + 1)^3)
Code:
%Problem 1
syms y(x)
% Differential
Dy = diff(y);
%original Differential
ode = diff(y,x,2) == cos(2*x)-y;
%Using boundary condition
cond1 = y(0)==1;
cond2 = y(2)==5;
conds = [cond1,cond2];
%Solving equation using 'conds' as condition
ySol(x) = dsolve(ode,conds)
%Polting with default range
fplot(ySol);
Plot:
Problem 2) :
SOlution:
uSol(x) =
(pi*exp(x))/3 - exp(-x/2)*cos((3^(1/2)*x)/2)*(pi/3 - 1) -
(3^(1/2)*exp(-x/2)*sin((3^(1/2)*x)/2)*(pi + 1))/3
Code:
%Problem 2
syms u(x)
% Differential
Du1 = diff(u);
Du2 = diff(Du1);
%original Differential
ode = diff(u,x,3) == u;
%Using boundary condition
cond1 = u(0)==1;
cond2 = Du1(0)==-1;
cond3 = Du2(0) ==pi;
conds = [cond1,cond2,cond3];
%Solving equation using 'conds' as condition
uSol(x) = dsolve(ode,conds)
%Polting with default range
fplot(uSol);
Plot:
Problem 3) :
SOlution:
xSol(t) =
2^(1/2)*((t*(t^2 - 3))/3)^(1/2) - 2
- 2^(1/2)*((t*(t^2 - 3))/3)^(1/2) - 2
Code:
%Problem 3
syms x(t)
%original Differential
ode = diff(x,t) == (t^2-1)/(x+2);
%Using boundary condition
cond = x(0)==-2;
%Solving equation using 'cond' as condition
xSol(t) = dsolve(ode,cond)
%Polting with default range
fplot(xSol);
Plot:
Problem 4) :
SOlution:
xSol(t) =
3^(1/3)*(4*t*(log(t) - 1) + 4)^(1/3)
3^(1/3)*((3^(1/2)*1i)/2 - 1/2)*(4*t*(log(t) - 1) + 4)^(1/3)
-3^(1/3)*((3^(1/2)*1i)/2 + 1/2)*(4*t*(log(t) - 1) +
4)^(1/3)
Code:
%Problem 4
syms x(t)
%original Differential
ode = diff(x,t) == 4*log(t)/x^2;
%Using boundary condition
cond = x(1)==0;
%Solving equation using 'cond' as condition
xSol(t) = dsolve(ode,cond)
%Polting with default range
fplot(xSol);
Plot:
Problem 5) :
Solution:
xSol(t) =
4^(1/4)*t*(log(t) + 64)^(1/4)
Code:
%Problem 5
syms x(t)
%original Differential
ode = (x^3)*t*diff(x,t) == t^4+x^4;
%Using boundary condition
cond = x(1)==4;
%Solving equation using 'cond' as condition
xSol(t) = dsolve(ode,cond)
%Polting with default range
fplot(xSol);
Plot:
Problem 6) :
EQUATION IS VERY BLURRY. UNABLE TO COMPREHEND WHAT'S WRITTEN IN EXPONENTIAL.
Kindly Comment correct Equation, I will give you the code for it.
Problem 7) :
UNABLE TO UNDERSTAND WHAT'S WRITTEN IN THE EXPONENTIAL.
USING THIS GUESSED EQUATION:
Solution:
xSol(t) =
(2*exp(t) + t^2*exp(t) - 2*t*exp(t) + t^2/2 + t^4)/t^2 - (exp(1) +
3/2)/t^2
Code:
%Problem 7
syms x(t)
%original Differential
ode = diff(x,t)-(1-2*x)/(t) == 4*t+exp(t);
%Using boundary condition
cond = x(1)==0;
%Solving equation using 'cond' as condition
xSol(t) = dsolve(ode,cond)
%Polting with default range
fplot(xSol);
Plot:
Problem 8) :
Solution:
xSol(t) =
exp(t/2)*cos((5^(1/2)*t)/2) -
(5^(1/2)*exp(t/2)*sin((5^(1/2)*t)/2))/5
Code:
%Problem 8
syms x(t)
%Differntial 1
Dx =diff(x);
%original Differential
ode = 2*diff(x,t,2)-2*Dx +3*x==0;
%Using boundary condition
cond1 = x(0)==1;
cond2 = Dx(0)==0;
conds=[cond1,cond2];
%Solving equation using 'conds' as condition
xSol(t) = dsolve(ode,conds)
%Polting with default range
fplot(xSol);
Plot:
Problem 9) :
Solution:
xSol(t) =
2*exp(-2*t)*exp(2) - 5*t*exp(-2*t)*exp(2) +
4*t^2*exp(-2*t)*exp(2)
Code:
%Problem 9
syms x(t)
%Differntial 1
Dx1 =diff(x);
Dx2 = diff(Dx1);
%original Differential
ode = diff(x,t,3)+6*Dx2 +12*Dx1+8*x==0;
%Using boundary condition
cond1 = x(1)==1;
cond2 = Dx1(1)==1;
cond3 = Dx2(1)==0;
conds=[cond1,cond2,cond3];
%Solving equation using 'conds' as condition
xSol(t) = dsolve(ode,conds)
%Polting with default range
fplot(xSol);
Plot:
Problem 10) :
Solution:
xSol(t) =
(12*exp(-t))/25 - (4*cos(2*t + atan(4/3)))/5 +
t*exp(-t)*((4*cos(atan(4/3) + 2)*exp(1))/5 - 12/25)
Code:
%Problem 10
syms x(t)
%Differntial 1
Dx =diff(x);
%original Differential
ode = diff(x,t,2)+2*Dx +x==4*cos(2*t);
%Using boundary condition
cond1 = x(0)==0;
cond2 = Dx(0)==2;
conds=[cond1,cond];
%Solving equation using 'conds' as condition
xSol(t) = dsolve(ode,conds)
%Polting with default range
fplot(xSol);
Plot:
Problem 11) :
Solution:
xSol(t) =
(8*exp(-t))/5 - (44*cos(3*t)*exp(-2*t))/65 +
(27*sin(3*t)*exp(-2*t))/65 + 1/13
Code:
%Problem 11
syms x(t)
%Differntial 1
Dx1 =diff(x);
Dx2 = diff(Dx1);
%original Differential
ode = diff(x,t,3)+5*Dx2 +17*Dx1+13*x==1;
%Using boundary condition
cond1 = x(0)==1;
cond2 = Dx1(0)==1;
cond3 = Dx2(0)==0;
conds=[cond1,cond2,cond3];
%Solving equation using 'conds' as condition
xSol(t) = dsolve(ode,conds)
%Polting with default range
fplot(xSol);
Plot:
Problem 12) :
Solution:
xSol(t) =
sin((7^(1/2)*t)/2)*(cos(4*t - (7^(1/2)*t)/2)/48 - cos(4*t +
(7^(1/2)*t)/2)/48 + sin(4*t - (7^(1/2)*t)/2)/16 - sin(4*t +
(7^(1/2)*t)/2)/16 + (17*7^(1/2)*cos(4*t - (7^(1/2)*t)/2))/336 +
(17*7^(1/2)*cos(4*t + (7^(1/2)*t)/2))/336 + (7^(1/2)*sin(4*t -
(7^(1/2)*t)/2))/16 + (7^(1/2)*sin(4*t + (7^(1/2)*t)/2))/16) -
cos((7^(1/2)*t)/2)*(cos(4*t - (7^(1/2)*t)/2)/16 + cos(4*t +
(7^(1/2)*t)/2)/16 - sin(4*t - (7^(1/2)*t)/2)/48 - sin(4*t +
(7^(1/2)*t)/2)/48 + (7^(1/2)*cos(4*t - (7^(1/2)*t)/2))/16 -
(7^(1/2)*cos(4*t + (7^(1/2)*t)/2))/16 - (17*7^(1/2)*sin(4*t -
(7^(1/2)*t)/2))/336 + (17*7^(1/2)*sin(4*t + (7^(1/2)*t)/2))/336) +
C3*exp((3*t)/2)*cos((7^(1/2)*t)/2) -
C4*exp((3*t)/2)*sin((7^(1/2)*t)/2)
Code:
%Problem 12
syms x(t)
%Differntial 1
Dx =diff(x);
%original Differential
ode = diff(x,t,2)-3*Dx+4*x==cos(4*t)-2*sin(4*t);
%Solving equation without Conditions
xSol(t) = dsolve(ode)
write MATLAB scripts to solve differential equations. Computing 1: ELE1053 Project 3E:Solving Differential Equations Project Principle...
Differential Equations with MATLAB/Plotting first order differential equations in Matlab/ Differential Equations MATLAB/IVP Matlab/IVP I'd really appreciate if I can get some help plotting these 3 first order differential equations as well as their comments. PLEASE! ANYTHING HELPS, I am very stuck :( EZplot and ODE 45 were mentioned in class and the instructions in class were not clear at all. Given the first order differential equation with initial condition. dy/dt = y t, y(0)=-1 Complete problems 1-3 in one...
Sheet1 Control 1. Solve the following differential equations using Laplace transforms. Assume zero initial conditions dx + 7x = 5 cos 21 di b. + 6 + 8x = 5 sin 31 dt + 25x = 10u(1) 2. Solve the following differential equations using Laplace transforms and the given initial conditions: de *(0) = 2 () = -3 dx +2+2x = sin21 di dx di dx di 7+2 x(0) = 2:0) = 1 ed + 4x x(0) = 1:0) =...
Problem #4. The convective heat transfer problem of cold oil flowing over a hot surface can be described by the following second-order ordinary differential equations. der 0 dx T(0)=0 (1) T(5)=1 where T is the dimensionless temperature and x is the dimensionless similarity variable. dr? +0.83, dT This is a boundary-value problem with the two conditions given on the wall (x=0, T(O) = 0) and in the fluid far away from the wall (x = 5,7/5) = 1). You are...
Solve the system of differential equations dx/dt = x-y, dy/dt = 2x+y subject to the initial conditions x(0)= 0 and y(0) = 1.
Matlab Homework #4: Matlab Linear Systems Simulation 1.) Obtain the differential equation for the mechanical system shown below bi FLR) orce CN) voltege ) 2.) Obtain the differential equation for the electrical system shown below shown below OAF 3.) Find the transfer functions corresponding to the differential equations found in questions I and 2 the 4) Let the input force applied to the block of the mechanical system be zero U)-のThe initial conditions are y(0) = 10 cm and dy(0)d-0....
Problem #4. The convective heat transfer problem of cold oil flowing over a hot surface can be described by the following second-order ordinary differential equations. d'T dT +0.83x = 0 dx? dx T(0)=0 (1) T(5)=1 where T is the dimensionless temperature and x is the dimensionless similarity variable. This is a boundary-value problem with the two conditions given on the wall (x=0, T(O) = 0) and in the fluid far away from the wall (x = 5, T(5) = 1)....
Matlab Code for these please. 4. Using inbuilt function in MATLAB, solve the differential equations: dx --t2 dt subject to the condition (01 integrated from0 tot 2. Compare the obtained numerical solution with exact solution 5. Lotka-Volterra predator prey model in the form of system of differential equations is as follows: dry dt dy dt where r denotes the number of prey, y refer to the number of predators, a defines the growth rate of prey population, B defines the...
Question 3 Consider the following linear system of differential equations dx: = 2x-3y dt dy dt (a) Write this system of differential equations in matrix form (b) Find the general solution of the system (c) Solve the initial value problem given (0) 3 and y(0)-4 (d) Verify the calculations with MATLAB Question 3 Consider the following linear system of differential equations dx: = 2x-3y dt dy dt (a) Write this system of differential equations in matrix form (b) Find the...
Consider the following linear system of differential equations: dx/dt = 2x-3y dy/dt = -x +4y (a) Write this system of differential equations in matrix form (b) Find the general solution of the system (c) Solve the initial value problem given x(0) = 3 and y(0) = 4 (d) Verify the calculations with MATLAB
please help Problem 1: Solve the following differential equations subject to the specified boundary conditions: a. 40, subject to y(o) 30 and y(1) 10 br,subject to T(O2) 0 c. da-a29-0, (a is a constant), subject to θ(0) 50 and θ(x-.00) dx2 d20 dx? 10