I have the following code to plot an approximation using Euler's iteration against the exact value of the function.
I have used x and y for time and population when coding the Euler iterations and t and m for time and population when plotting the exact function. I can't work out how to initialise the m value when plotting the exact function. M(0)=13. When executed the plot looks correct except for that.
"%Compute and Graph Euler's Iteration of dM/dt=-1/40M(M-30) (using x and y)
%Graph Exact Solution of m=30./(1+((17/3)*exp(-3.*t/4)))
x=0; %Initialise x value
y=13; %Initialise y value
dx=1; %Step size
n=20; %Number of values to be calculated
disp(' x y')
t=0:1:20; %Set range of t being alternate units for time in years
m=30./(1+((17/3)*exp(-3.*t/4))); %Population from Exact Function
xlabel('Time in Years');
title('Graph Showing Euler Approximation and Exact Value of Function')"
Wondering if anyone is able to help.