Question: Solve using matlab PROBLEM 4 The amount of mass transported via a pipe over a period of time can be computed as M = t
Solve using matlab
PROBLEM
The amount of mass transported via a pipe over a period of time can be computed as
where mass the initial time :min the final time flow rate and concentration
The following functional representations define the temporal variations in flow and concentration:
Determine the total mass passing through the pipe within the first seconds. Compare Romberg integral with Simpson's Rule.
Use the following function files to help solve
function EI IntSimpxy
Integral Simpsons Rule
using LeastSquares Regression
Input List
x independent data stream
y dependent data stream
Output List
EI sum of integral segments
N lengthx;
Q floorN;
I zerosQ;
for q :Q
i q;
A LSRegPolyxi:iyi:i;
IqAxi xi
Axi xi
Axi xi
Axi xi;
end
EI sumI;
if i N
EI EI IntSimpxi:Nyi:N;
end
end
function EI Rombergxyxy
Integral NewtonCotes Polynomial
using LeastSquares Regression
Input List
x independent data stream #
y dependent data stream #
x independent data stream #
y dependent data stream #
Output List
EI sum of integral segments
N lengthx;
if nargin && modN
x x::end;
y y::end;
end
dx x x;
dx x x;
Ia NewtonCotesxy;
Ia NewtonCotesxy;
note spacing should be uniform!
EI IaIa Iadxdx;
end
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
