clc %clear console and return cursor to home format long %actual function tm = linspace(0,10,100); N0 = 10; R0 = 0.75; Nd_smth = N0*exp(R0*tm); M = length(Nd_smth); %generate vals from random distr with mean = mn and stdv = stdv rng('default'); %fix seed for random # generator to matlab startup seed mn = 0; %mean stdv = 1000; r_pb = mn + stdv.*randn(1,M); Nd = r_pb+Nd_smth; %data plot(tm,Nd,'bx') N = @(N0,R0,t) N0.*exp(R0*t); %function handle to your exponential fctn %part 1 % use your solution from 34.14 part c) to solve for N0 and R0 an plot it % %N0 = ? %R0 = ? % %plot(t,Nd,'bx',t,N(N0,R0,t),'r-') %part 2 % Use gradient descent to find N0 and R0 directly from the original problem % formulatiom in 34.14 part a)