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

Write the MATLAB code for this problem The following are the model for Dynamics

ID: 3773679 • Letter: W

Question

Write the MATLAB code for this problem

The following are the model for Dynamics of 3 tanks in series Tanks 1 dC_1 / dt = 1 / tau (C_0 - C_1) Tank 2 dC_2 / dt = 1 / tau (C_1 - C_2) Tank 3 dC_3 / dt = 1 / tau (C_2 - C_3) Where C_1,.C_2 and C_3 are the concentration in tank1, tank 2, and tank 3, respectively. C_0 = 0.1, time constant tau = 10 minute. Get the concentration profile of tanks for time span 0 to 50 minute by solving above system of ODE using solver ode45. Analytical solution of tank 1 concentration is C_1 = C_0 (1 - e^-t / tau) Plot tank 1 concentration (Analytical & numerical) to compare the results.

Explanation / Answer

#include #include #define MAX 10 void main() { FILE *fp; int number,i,j; float xvalue[MAX],yvalue[MAX],search,product; float sum=0; fp=fopen("lgrninv.dat","w"); clrscr(); printf(" "); fprintf(fp," "); printf("How many numbers you want to enter for x : "); fprintf(fp,"How many numbers you want to enter for x : "); scanf("%d",&number); fprintf(fp,"%d",number); for(i=0;i