I have all of my code done and now I am trying to publish the code in a pdf file and have it show the code, the answers, and the graphs. Here is my code:
if true % code
%
%Math 246
%MATLAB #1
%4
syms y(t) cdsolve(diff(y) - 2*y == sin(2*t), y(0) ==c)%c=-0.5
ezplot(exp(2*t)*(-.5 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%c=-0.45
ezplot(exp(2*t)*(-.45 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%c=-0.40
ezplot(exp(2*t)*(-.40 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%c=-0.35
ezplot(exp(2*t)*(-.35 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%c=-0.30
ezplot(exp(2*t)*(-.30 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%c=-0.25
ezplot(exp(2*t)*(-.25 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%c=-0.20
ezplot(exp(2*t)*(-.20 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%c=-0.15
ezplot(exp(2*t)*(-.15 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%c=-0.10
ezplot(exp(2*t)*(-.10 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%c=-0.05
ezplot(exp(2*t)*(-.05 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%c=0
ezplot(exp(2*t)*(0 + 1/4) - (2^(1/2)*cos(2*t - pi/4))/4)%Between the interval c= -0.5 to c= -0.30 the graph show a constant
%function until t= 2. At t= 2 y becomes -infinity as t goes to 5. The graph
%turns into a normal cosine curve when c= -0.25. Then from t= -0.20 to t= 0
%the graph does not change, is constant around y= 0 until t approaches 2.
%Then the graph goes towards postive infinity as t gets to 5. Finally this
%proves that any initial data can change the whole shape and the direction that the graph provides.
%9a
syms t y(t) cy(t) = dsolve(diff(y,t) == y/(1+t^2), y(0)==c)%9b
ezplot(-10*exp(atan(t)))hold on;ezplot(-9*exp(atan(t)))hold on;ezplot(-8*exp(atan(t)))hold on;ezplot(-7*exp(atan(t)))hold on;ezplot(-6*exp(atan(t)))hold on;ezplot(-5*exp(atan(t)))hold on;ezplot(-4*exp(atan(t)))hold on;ezplot(-3*exp(atan(t)))hold on;ezplot(-2*exp(atan(t)))hold on;ezplot(-1*exp(atan(t)))hold on;ezplot(0*exp(atan(t)))hold on;ezplot(1*exp(atan(t)))hold on;ezplot(2*exp(atan(t)))hold on;ezplot(3*exp(atan(t)))hold on;ezplot(4*exp(atan(t)))hold on;ezplot(5*exp(atan(t)))hold on;ezplot(6*exp(atan(t)))hold on;ezplot(7*exp(atan(t)))hold on;ezplot(8*exp(atan(t)))hold on;ezplot(9*exp(atan(t)))hold on;ezplot(10*exp(atan(t)))hold off;axis([-20 20 -40 40])%9c
limit(1*exp(atan(t)),t,inf)%9d
%When t is negative, ysub a-ysub b will always be equal or less than a-b.
%9e
%This theorem proves that for any set bound by t but not y the inital
%values times a constant will equal those functions substracted.
%19a
clear all;syms t y s;[t, y] = meshgrid(-1:0.2:5, -1:0.2:5);s = -y.^3+4*y.^2-3*y;quiver(t, y, ones(size(s)), s)%y= 0 is stable, y= 1 is unstable, y= 3 is stable. The slope is heading
%towards infinity in the interval between 1 and 3. Once it is greater than
%3 the slopes slant and almost become vertically downward pointing at 3.
%For 1 the slope is 0 and for between 0 and 1 the slope is going towards 0.
%19b
clear all;syms t y;[t, y] = meshgrid(0:.5:12, -5:.5:12);s = (y.*(1-log(y)).*(y-3));quiver(t, y, ones(size(s)),s)%The equilibrium solutions are y= 0, y= e, y= 3.
%19c
clear all;syms t y;ezplot(y*(1-log(y))*(y-3))axis([0 4 -8 0]);limit(y*(1-log(y))*(y-3),y,0)%19d
%y= 0 is stable. y= e is hard to find whether it is stable or unstable
%because the direction plot is unclear. Where y= 3 it is unstable. In the
%graph y= 0 at or around e which can not exist because the natural log of 0
%does not exist. This is why the stability between y= 2.5 and y= 3, which
%is in the interval containing e.
end
For example none of the ezplot graphs from #4 are showing up when I publish the file.
Best Answer