Question
Module 1 MATLAB Homework Sketch, using MATLAB, the slope field and then draw some solution curves for dy dx =x-y Interpret your solution curves; that
Module 1 MATLAB Homework
- Sketch, using MATLAB, the slope field and then draw some solution curves for
dydx=x-y
Interpret your solution curves; that is, describe the behavior of the function f(x, y).
dydx=y-sinx
Interpret your solution curves; that is, describe the behavior of the function f(x, y).
- Use MATLAB to find the general real solution to of the differential equation
dydx=cosxy2
I need help getting the solution curves into my MATLAB code.... Please help?
%given example %figure(2); %[T,Y]=meshgrid(-2:0.2:3,-1:0.2:2); %S=Y-Y.^2; %L=sqrt(1+S.^2); %quiver(T,Y,1./L,S./L,0.5),axis equal tight %xlabel 't', ylabel 'y' %title 'Direction Field for dy/dt=y-y^2'
%Problem 1a Sketch, using MATLAB, the slope field %and then draw some solution curves for dy/dx= x-y figure(1) [X,Y]=meshgrid(-2:0.2:3,-1:0.2:2); S=X-Y; L=sqrt(1+S.^2); quiver(X,Y,1./L,S./L,0.5),axis equal tight xlabel 'x', ylabel 'y' title 'Direction Field for dx/dy=x-y' ; %Problem 1b Sketch, using MATLAB, the slope field %and then draw some solution curves for dy/dx= y-sin(x) figure(2) [X,Y]=meshgrid(-2:0.2:3,-1:0.2:2); S=Y-sin(X); L=sqrt(1+S.^2); quiver(X,Y,1./L,S./L,0.5),axis equal tight xlabel 'x', ylabel 'y' title 'Direction Field for dy/dx=y-sinx' ; %Solve Given Differential Equation syms y(x) eqn=diff(y,x)==cos(x)/y^2; ySol(x)=dsolve(eqn); fprintf('The general solution for dy/dx= cos(x)/y^2 is y(x)= ') disp(ySol(x)) ;
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