MatLab Ive been working this out for a few hours and trail a
MatLab I\'ve been working this out for a few hours, and trail and error doesn\'t seem to help. In the manufacturing of ball bearings, the components, such as the ball, are hardened through a process of heating and then rapid cooling or “quenching” by submersion in an oil or water bath. The temperature of the ball as a function of time, T(t), in the bath may be estimated as: T(t) = (Ti – T)e–t/ + T where t is the time in seconds in the bath; Ti is the initial ball temperature; T is the oil temperature; and is the time constant in seconds and depends upon the material of the ball, the geometry of the ball, and oil properties. Write a MATLAB function that utilizes Ti; T; ; and three separate times, t, as input arguments and returns the ball temperature for the three times as a one-dimensional array. Assuming an initial ball temperature of 1000°C, an oil temperature of 60°C, and the time contant = 60 s, determine the ball temperature for times of 1, 10, and 100 seconds.
Solution
There are two ways to do this:
First:
Ti=[1000 0 0;0 1000 0;0 0 1000];
Tu=[60 0 0;0 60 0;0 0 60];
Temp diff=Ti-Tu;
A=[exp(-1/60);exp(-10/60);exp(-100/60)];
B=[1;1;1];
Final Temp=Temp Diff*A + Tu*B;
disp(Final Temp);
Second:
Ti=1000;
Tu=60;
T=60;
A=[1,10,100];
B=[0,0,0];
x=1;
while(x<4)
B(x,1)=((Ti-Tu)*exp(-A(x,1)/T))+Tu;
x=x+1;
end
disp(B);
