Question

Write a matlab script file to solve the differential equation dy/dt = 1 − y^3 with...

Write a matlab script file to solve the differential equation dy/dt = 1 − y^3 with initial condition y(0)=0, from t=0 to t=10. matlab question

Homework Answers

Answer #1

Code:

%quation y' = 1 - y^3
f = @(t,y) 1 - y^3;
%Initial condition y(0) = 0
y0 = 0;
%Initial t = 0
t0 = 0;
%Final t = 10
tf = 10;
%Using ode45 function to solve differntial equation
[t,y] = ode45(f, [t0,tf], y0);

%plotting the result
plot(t,y);
%Labelling x and y axis and turning on the grid
xlabel('t');
ylabel('y(t)');
grid on;

Code Photo:

Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Consider the differential equation y′′+ 9y′= 0.( a) Let u=y′=dy/dt. Rewrite the differential equation as a...
Consider the differential equation y′′+ 9y′= 0.( a) Let u=y′=dy/dt. Rewrite the differential equation as a first-order differential equation in terms of the variables u. Solve the first-order differential equation for u (using either separation of variables or an integrating factor) and integrate u to find y. (b) Write out the auxiliary equation for the differential equation and use the methods of Section 4.2/4.3 to find the general solution. (c) Find the solution to the initial value problem y′′+ 9y′=...
dx/dt - 3(dy/dt) = -x+2 dx/dt + dy/dt = y+t Solve the system by obtaining a...
dx/dt - 3(dy/dt) = -x+2 dx/dt + dy/dt = y+t Solve the system by obtaining a high order linear differential equation for the unknown function of x (t).
Solve the following differential equation using Laplace dy/dt +2y=12sin4t y(0) =10
Solve the following differential equation using Laplace dy/dt +2y=12sin4t y(0) =10
Solve the differential equation (3y^2+2ty)+(2ty+t^2)dy/dt=0
Solve the differential equation (3y^2+2ty)+(2ty+t^2)dy/dt=0
1) Solve the given differential equation by separation of variables. exy dy/dx = e−y + e−6x...
1) Solve the given differential equation by separation of variables. exy dy/dx = e−y + e−6x − y 2) Solve the given differential equation by separation of variables. y ln(x) dx/dy = (y+1/x)^2 3) Find an explicit solution of the given initial-value problem. dx/dt = 7(x2 + 1),  x( π/4)= 1
Solve the di↵erential equation (t)dy/dt + 2y = 4t^2-3t + 4 subject to the initial condition...
Solve the di↵erential equation (t)dy/dt + 2y = 4t^2-3t + 4 subject to the initial condition y(1) = 3.
Solve the system of differential equations using laplace transformation dy/dt-x=0,dx/dt+y=1,x(0)=-1,y(0)=1
Solve the system of differential equations using laplace transformation dy/dt-x=0,dx/dt+y=1,x(0)=-1,y(0)=1
Solve the Homogeneous differential equation (7 y^2 + 1 xy)dx - 1 x^2 dy = 0...
Solve the Homogeneous differential equation (7 y^2 + 1 xy)dx - 1 x^2 dy = 0 (a) A one-parameter family of solution of the equation is y(x) = (b) The particular solution of the equation subject to the initial condition y(1) =1/7.
Use the Laplace transform to solve the given system of differential equations. 2 dx/dt + dy/dt...
Use the Laplace transform to solve the given system of differential equations. 2 dx/dt + dy/dt − 2x = 1 dx/dt + dy/dt − 6x − 6y = 2 x(0) = 0, y(0) = 0
dx + (x cot y + sin y) dy=0, Solve the differential equation and write your...
dx + (x cot y + sin y) dy=0, Solve the differential equation and write your answer without negative exponents.