Question: Please write a Matlab code as the solution to the following task. In lectures we considered the problem of phosphorous exchange between the upper and

Please write a Matlab code as the solution to the following task.
In lectures we considered the problem of phosphorous exchange between the upper and lower ocean. Over time, the phosphorous in the upper ocean dissipates into the lower
ocean. This diffusion effect helps life survive. In this problem you will explore the effects of change in ocean temperature on the retention of phosphorous in these layers
Given m1,m2 represent the concentration of phosphorous in tera-moles in the lower and upper ocean respectively, the rate of change of these concentrations w.r.t. time are
governed by the following pair of smultaneous differential equations.
dm1dt=-k12m1+k21m2;dm2dt=k12m1-k21m2
Here t is measured in years, and k12=0.58,k21=1.87 are coefficients which express the diffusion rate between the layers of ocean.
Assume that at t=0 years, m1(0)=87.5Tmol, and M=280Tmol. Phosphorous doesn't dissappear over time, it just moves around. Hence the total mass of phosphorous in
the ocean is a constant and so m2(0)=M-m1(0).
Task 1: Write two functions called lowerocean and upper0cean which take the samle arguments (k12,k21,?'m1,m2 and return the derivatives delm1delt and delm2delt respectively.
Task 2: Solve for m1(t) and m2(t) over a time interval of 0 to 5 years in steps of 3 months, using Euler's method. Store your output data in variables m1.3 and m2. e3. Calculate
the concentrations of phosphorous in the lower and upper ocean at t=3 years, assign these to variables m1 pe and m2 pe respectively.
Task 3: Solve for m1(t) and m2(t) over a time interval of 0 to 5 years in steps of 1 month, using Euler's method. Store your output data in variables m11_e1 and m2_e1.
Task 4 : Render these estimates in Figure 1 as follows.
Plot m1_e3 and m2_e3 using a blue line with + markers for each point. No need to change linewidths or markersizes
Plot m1_e1 and m2_e1 using a green line with "." markers (a dot) for each point. Use markersize 8 so you can see the points
Task 6 : The ocean temperature changes by 1 deg Celcius. This causes k12 to increase by 5%. Repeat Task 3 but store your output in variables m1?e1_hot and m2_e1_hot.
Render these new estimates in Figure 2 as follows.
Plot m1_e1 and m2_e1 using a black line with x markers for each point.
Plot m1?e1_hot and m2e1dots hot using a red line with "." markers for each point and markersize of 8
Task 7 : Using your results from Task 6,h=1 month, calculate the percentage change in phosphorous in the lower and upper ocean after 3 years. Assign these values to the
variable m1_change_hot and m2_change_hot. Use the following calculation to measure percentage change 100|mhot-m|m, where mhot is the value of m after the change and
m is the value before the change. Apply this to changes in both m1,m2.
Hints: You might find it easier to write your Euler's solution as a function. But you'll have to wrestle with qetting those functions to call your two qradient functions.
 Please write a Matlab code as the solution to the following

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!