% this file provides a model fit for the temperature data % the file assumes that bulbdata.m has already been run % and thus the vector bulbtemp1 already exists in memory % along with the time vector t % data taken for temperature of glass envelope of my desk lamp at home % 75W light bulb % temperature in degrees Centigrade, measured with thermocouple % data taken at 5 sec intervals (yeah, that's a lot of points) % bulb turned on at t=0 % bulb turned off at t= 655 sec % I bumped the test lead at about 1130 sec; bump in data results % D L Trumper 8/24/2004 tau =160; % time constant in sec for model fit tempfinal = 120; % the final value of the temperature rise above ambient figure(2) clf model1 = tempfinal*(1-exp(-t/tau)); model2 = tempfinal*(exp(-(t-665)/tau)); % ambient temperature is 29 C % subtract from bulb temp in plot % overlay model data plots on experimental data plot(t,(bulbtemp1-29),'*',t,model1,t,model2) axis([0 1600 0 120]) xlabel(['Time (sec); Model time constant = ',num2str(tau), ' sec']); ylabel('Temperature rise above ambient [C]') title('Model fit to light bulb dynamics')