# Question & Answer: Complete the MATLAB functions to plot the solutions for x(t) and x'(t) of this system for 0 lessthanorequalto t lessth…..

PLEASE SHOW CLEAR WORK .. THANK YOU ..

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: Complete the MATLAB functions to plot the solutions for x(t) and x'(t) of this system for 0 lessthanorequalto t lessth…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

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

As per the given euation:-

x= -2x -(6×3+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.