Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the following differential equations: y\'(t) = cos(y) + sin(t) y\'(t) = y *

ID: 3028071 • Letter: F

Question

For the following differential equations:
y'(t) = cos(y) + sin(t)
y'(t) = y * (2-y)

a. Modify the function F.m in MATLAB to match the given differential equation above.

function [ value ] = F( t, y )
%The function " F "
% This function is used to define our differential equation

value = y*sin(t*pi/2);

b. Run the file ExampleSlopeField.m to generate a slope field of the differential equation. Constrain the dimensions of your plot to be -4 <= y <= 4 and -4 <= t <=4 and the spacing between the slope lines should be 0.5.

% We clear all variables which may have been defined
clear

% These variables define the minimum and maximum values
% for "T" in the slope field.
T_min = -10;
T_max = 10;

% These variables define the minimum and maximum values
% for "Y" in the slope field.
Y_min = -10;
Y_max = 10;
% These variables define the spacings between the slope lines
% in the T and Y directions.
T_step = 1;
Y_step = 1;


% This creates a new figure window and plots the slope field
figure
SlopeField( T_min, T_max, T_step, Y_min, Y_max, Y_step )

F (1) m function value F t, y The function II F II This function is used to define our differential equation value y*sin (t *pi/2) end

Explanation / Answer

a) Given y'(t) = cos(y) + sin(t)
y'(t) = y * (2-y)

The code is given below

function [ value ] = F( t, y )
%The function " F "
% This function is used to define our differential equation

value = cos(y) + sin(t);

value = y * (2-y);

end

b) Modified code is given below

% We clear all variables which may have been defined
clear

% These variables define the minimum and maximum values
% for "T" in the slope field.
T_min = -4;
T_max = 4;

% These variables define the minimum and maximum values
% for "Y" in the slope field.
Y_min = -4;
Y_max = 4;
% These variables define the spacings between the slope lines
% in the T and Y directions.
T_step = 0.5;
Y_step = 0.5;


% This creates a new figure window and plots the slope field
figure
SlopeField( T_min, T_max, T_step, Y_min, Y_max, Y_step )