You are on page 1of 2

9/15/15 11:39 AM

\\base\roo...\CBE353ProblemSet2Problem1.m

function CBE353ProblemSet2Problem1

function [Qapprox] = Qapprox(T)


Qapprox=0.107*T;
end
function [QatT] = exactperT(T)
QatT=0;
J=0;
QatTi=1;
while QatTi>0.0000000000000000001
QatTi=(2*J+1)*exp(-9.347*(1/T)*(J*(J+1)));
QatT=QatT+QatTi;
J=J+1;
end
end
%-------Finding Exact Values------Temperatures=1:1:100;
Qvalues=1:length(Temperatures);
for i=1:length(Temperatures)
T=Temperatures(i);
Qvalues(i)=exactperT(T);
end
%----Finding Approximate Values---ApproxQValues=0.107.*Temperatures;
%-----Plotting-----hold on
plot(Temperatures,Qvalues,'LineWidth',1,'Color','black')
plot(Temperatures,ApproxQValues,'LineWidth',1)
%----Finding the Temperature----for j=1:length(Temperatures)
if abs(Qvalues(j)-ApproxQValues(j))/Qvalues(j) <= 0.05
TIntersect=Temperatures(j);
break
end
end
TIntersect

end

1 of 2

9/15/15 11:39 AM

\\base\roo...\CBE353ProblemSet2Problem1.m

2 of 2

You might also like