Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please do this on matlab 8. In cosmology the behavior of space through time is g

ID: 3168082 • Letter: P

Question

please do this on matlab

8. In cosmology the behavior of space through time is given by a function called the scale factor-r (t). The variable, t, is related to time and has the range 0 to 2pi with interval 0.01. The Freedman model predicts three possible behaviors of the scale factor depending upon estimates of the amount of matter in the universe. The amount of matter depends on a factor known as Epsilon (E) being 0, +1 or 1. with E =0 then r (t) -ct/2, With E-1 then r (t)-G (cosh (t) -1) with E = +1 then r (t) = G(1-cos (t)). G is related to Newton's gravitational constant and G = 64000 Write a program that will asks the user for the epsilon value from which the curve of r versus t will be produced within the given time interval. The program should terminate if the user enters a non-valid value of E. HINT: The while loop should be controlled with or' logic for the three values of E. Run the program for all three epsilon cases, as well as, termination to be sure it is working. USE WHILE loop and If -elseif else structure

Explanation / Answer

____________________________________________________________

%%MATLAB CODE

G=64000;
t=0:0.01:2*pi;
prompt='Choose value of e from 0,-1 or +1'
e=input();

while e==0||e==-1||e==1||e==+1
if e==0
r=(G.*t)/2;
elseif e==-1
r=G*((cosh(t))-1);
else
r=G*(1-(cosh(t)));
end
plot(t,r);

end

_____________________________________________________________