Answered step by step
Verified Expert Solution
Question
1 Approved Answer
clear all %define symbolic variablesx = x(t), y = y(t) syms x1(t) x2(t) x = [x1;x2]; % for the solution vector A = [9 5;
clear all %define symbolic variablesx = x(t), y = y(t) syms x1(t) x2(t) x = [x1;x2]; % for the solution vector A = [9 5; -6 -2]; % write in the matrix A sol = dsolve(diff(x) == A*x, x(0) == [2;3]); % solve this analytically %display the analytic solutions in the Matlab window sol1 = sol.x1 sol2 = sol.x2 %evaluate solutions for time t in the interval [0, tmax] tmax = 5; t=linspace(0,tmax,100);%creates a "time" vector of length 100, with entries from 0 to tmax xx1=subs(sol.x1, t); %evaluate the solution x(t) where t is in the interval [0, tmax] xx2=subs(sol.x2, t); plot(t,xx1,'r-',t,xx2,'b-'); title('Solutions to the system dx/dt=Ax,A = [9 5; -6 -2]') legend('Solution x1(t)','Solution x2(t)'); xlabel('time'); ylabel('solutions x_i(t)') %find and display the eigenvalues for A evals= eigs(A) return2D systems x'Ax with A a 2 by 2 matriz Recall the problem we solved in class xAx with A 9 5;-6-2 and initial conditions x(0) 2:3 (a) Verify (using the code provided in WebWork under week2) that the solution we ob- tained in class is the same as the solution found via the given code. Write the solution found in Matlab below: (b) Based on your result to part (a), give the solution to this problem at time t 4 (c) Modify the given Matlab code to solve x' = Ax with A = [1-2:2 1] and initial conditions x(0) = 10:4. Write the solutions below
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started