Question

Hey guys,

I would like to solve these equations using ode45 in MATLAB

QUESTION 1)

b2-1.ば2-(222-v211. 22(0)=220 predator 22

QUESTION 2)

dr2 cr1 +k(t)), 12_ x2(to) =y0.

where k and c are:

:= k(t)

For a better understanding of how these values came about:

kle fes ya Building Spring/ Damper Wheel Axle Tires Street

I deeply appreciate your assistance to these guys.

Thanks

b2-1.ば2-('22'2-v211. 2'2(0)=220 predator 2'2
dr2 cr1 +k(t)), 12_ x2(to) =y0.
:= k(t)
kle fes ya Building Spring/ Damper Wheel Axle Tires Street
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question 1)

MATLAB code is given below in bold letters.

clc;
close all;
clear all;

% define the time range
t = 0:0.1:5;

% define the initial conditions
x0 = [1 ; 1];

[t,y] = ode45(@vdp1,t,x0);

% Plot the solutions fot y(t) and ydot(t) against t.
figure;plot(t,y(:,1),'-o',t,y(:,2),'-o')
title('Solution of Equation with ODE45');grid;
xlabel('Time t');
ylabel('Solution x1(t) and x2(t)');
legend('x1','x2')

function dydt = vdp1(t,x)
% inpuut
u = ones(size(t));

% Assume the constants
a1 = 1;
b1 = 1;
c1 = 1;
v1 = 1;

b2 = 1;
c2 = 1;
v2 = 1;

% Define the derivatives of the states ydot(t)
dydt = [a1*x(1)-b1*x(1)*x(2)-c1*x(1)-v1*u; b2*x(1)*x(2)-c2*x(2)-v2*u];

The result is plotted below

Solution of Equation with ODE45 듦 -3 び) -6 -7 0 0.5 11.5 2 2.5 33.5 4.5 5 Time t -8

Question 2)

MATLAB code is given below in bold letters.

clc;
close all;
clear all;

% define the time range
t = 0:0.1:10;

% define the initial conditions
x0 = [1 ; 1];

[t,y] = ode45(@vdp1,t,x0);

% Plot the solutions fot y(t) and ydot(t) against t.
figure;plot(t,y(:,1),'-o',t,y(:,2),'-o')
title('Solution of Equation with ODE45');grid;
xlabel('Time t');
ylabel('Solution x1(t) and x2(t)');
legend('x1','x2');

function dydt = vdp1(t,x)
% inpuut
k = ones(size(t));

% Assume the constants
d = 1;
c = 1;
k = 1;
m = 1;

% Define the derivatives of the states ydot(t)
dydt = [x(2);1/m*(-d*x(2)-c*x(1)+k)];

The result is plotted below

Solution of Equation with ODE45 1.6 CN 0.81 e 0.4 0.2 -0.2 0 1 234 5 6 78 910 Time t 0.4

Add a comment
Know the answer?
Add Answer to:
Hey guys, I would like to solve these equations using ode45 in MATLAB QUESTION 1) QUESTION 2) where k and c are: For a better understanding of how these values came about: I deeply appreciate you...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT