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

PLEASE SHOW CLEAR WORK .. THANK YOU .. Complete the MATLAB functions to plot the

ID: 3867659 • Letter: P

Question

PLEASE SHOW CLEAR WORK .. THANK YOU ..

Complete the MATLAB functions to plot the solutions for x(t) and x'(t) of this system for 0 lessthanorequalto t lessthanorequalto 1 using MATLAB ode45. Function Final Problem will do the plotting. and has no input or output arguments. Function myode will contain the system of ode to be used by ode45. Fill in the input and output arguments for this fraction. x = -2x - (6x^3 + 4x): x(0) = 1, x(0) = 0 From MATLAB help: [TOUT, YOUT] = ode45 [ODEFUN, TSPAN, Y0] with TSPAN = [T0 TFINAL] function Final Problem end function myode() end

Explanation / Answer

As per the given euation:-

x= -2x -(6x3+4x);

x(0) = 1, x'(0) = 0

let x1 = y and x2 = y'

So, x1' = x2

& x2' = -2x2 -(6x13+4x1)

Here is the matlab code segment:-

%%=================================

function dydt=myode(t,y)

dydt = [y(2); (6*y(1)^3)-4*y(1)];

end

function Finalfunction

[t,y]=ode45('myode',[0,1],[1,0]);

subplot(2,1,1);

plot(t,y(:,1),'r');

grid on;

title('Subplot 1: dydt vs time')

xlabel('dydt') % x-axis label

ylabel('Flow') % y-axis label

subplot(2,1,2);

plot(t,y(:,2),'r');

grid on;

title('Subplot 2: y vs time')

xlabel('y') % x-axis label

ylabel('time') % y-axis label

end

%==================================

Please run these codes into your matlab window and checkout the output.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote