I have a problem and it\'s solved already but I want Write the Euler function an
ID: 3027938 • Letter: I
Question
I have a problem and it's solved already but I want Write the Euler function and use it to solve the problem and find an optimum step all of that by using the Matlab.
Q-A ball at 1200K is allowed to cool down in air at an ambient temperature of 300K. Assuming heat is lost only due to radiation, the differential equation for the temperature of the ball is given by d(theta)/dt=-2.2067x10^-12(theta^4-81x10^8).
Ster! -12 Ceu- 81x108) 01 =-z, 20140 f(t0)5-2,L0610 L Cgh-flxlot) .Nao +(o, iLoo) 24 uo t c-1-206tx lo-) L (iLoos_GL*)) 240 12o o + C-y.rr 7-f) 240 . A. I06.9 k G. is approximate 4cmpm Her at," t4 tt hz 2"La _ 240 step fivl2400,2LOb-09 166-01f ( e4s06.0) 240 lo 6.04 + C-210(7Lo"mClofo9 4-9LX 10) 24c 110,31 k On, 2 is m appvp>Explanation / Answer
The first problem is your use of exp. That function "returns the base-e exponential function of x, which is the e number raised to the power x." . The function power is what you need for y to the x. I believe your code should look something like what I've done below. In this solution, the temperature gets to just under 301 at 199 seconds, then to 300.000 at 318 seconds.
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
double y = 1200.0,
k1 = -2.2067 * pow(10.0,-12.0),
k2 = (81.0 * pow(10.0,8));
int t;
for (t = 1; t <= 480; t++) {
y += (t * (k1 * (pow(y,4.0) - k2)));
if (t < 15) printf("y(%d) = %g ",t,y);
}
printf(" ... y(480) = %g ",y);
return 0;
}
#if 0
Program output:
y(1) = 1195.44
y(2) = 1186.46
y(3) = 1173.4
y(4) = 1156.74
y(5) = 1137.07
y(6) = 1115.05
y(7) = 1091.29
y(8) = 1066.4
y(9) = 1040.88
y(10) = 1015.15
y(11) = 989.57
y(12) = 964.391
y(13) = 939.809
y(14) = 915.959
...
y(480) = 300
#endif
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.