Question
%------------------------------------------------------ % (1) For the Matlab code below, study the code, then do the following % . (a)Type what's the code for? explaining all formulas/functions
%------------------------------------------------------ % (1) For the Matlab code below, study the code, then do the following % . (a)Type what's the code for? explaining all formulas/functions used % . (b) Plot the flowchart % . (c)Change the code so that it plots the vector field with contours (at % 5 values only) of a linear ODE system, arrows' heads on, axis tight, legend, % arrows are red-color and contours should be black if over xy-plane and % blue if under xy-plane, title, captions,.... %===================================== function myquiver xmin = 0; xmax = 25; ymin = 0; ymax = 0.5;
R=2.3; C=1.2; V=@(t) 3*sqw(t,1,10); F=@(t,VC) (V(t)-VC)/(R*C); [T,VC]=meshgrid(linspace(xmin,xmax,10),linspace(ymin,ymax,10)); S=(3*sqw(T,1,10)-VC)/(R*C); L=sqrt(1+S.^2);
x_span = xmax - xmin; y_span = ymax - ymin; % Compute the scale factor so that vectors are 10% of plot window d = 0.1; X_world = 1./L; Y_world = S./L; s = d ./ sqrt((X_world / x_span).^2 + (Y_world / y_span).^2); quiver(T,VC,s.*X_world,s.*Y_world,'r','ShowArrowhead','off','AutoScale','off') axis([xmin,xmax,ymin,ymax])
% force the axis to be square axis('square');
function y=sqw(t,T,d) r=mod(t,T); y=(r
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