Can you please help with this question? Please answer the question in MATLAB coding. Thank you in advance!!
main.m
clc
clear
clc
clear
t0 = 0;
y0 = 0;
tEnd = 10;
h = 0.1;
N = (tEnd - t0)/h;
%% Initializing solution
t = [t0:h:tEnd]';
yA = zeros(N + 1, 1);
yA(1) = y0;
yB = zeros(N + 1, 1);
yB(1) = y0;
%% Solving using Euler's Explicit Method
for i = 1:N
fi = funVolA(t(i), yA(i));
yA(i + 1) = yA(i) + h*fi;
fiB = funVolB(t(i), yB(i));
yB(i + 1) = yB(i) + h*fiB;
end
plot(t, yA, 'r-');
hold on
plot(t, yB, 'b-');
xlabel('t');
ylabel('y');
legend('Solution A.', 'Solution A.','Location','northwest');
funVolA.m
function dy = funVolA(t, y)
Q = 450;
A = 1250;
dy = (3*Q* sin(t)^2 - Q)/A;
end
funVolB.m
function dy = funVolB(t, y)
Q = 450;
A = 1250;
alpha = 150;
dy = (3*Q* sin(t)^2 - alpha*(1 + y)^1.5)/A;
end
Output:
Can you please help with this question? Please answer the question in MATLAB coding. Thank you in advance!! A storage tank (shown below) contains a liquid at depth y where y 0 when the tank is half f...
Consider a cylindrical storage tank with surface area A which contains a liquid at depth y:At time t = 0, the tank is empty (y = 0 when t = 0). Liquid is supplied to the tank at a sinusoidal
rate Qin =3Qsin2
(t) and withdrawn from the tank as:
𝑄𝑜𝑢𝑡 = 3(𝑦 − 𝑦𝑜𝑢𝑡)
1.5
if 𝑦 > 𝑦𝑜𝑢𝑡
𝑄𝑜𝑢𝑡 = 0 if 𝑦 ≤ 𝑦𝑜𝑢𝑡 Please note that both 𝑄𝑖𝑛 and 𝑄𝑜𝑢𝑡 have units m3
/h. The mass...
Please answer the question in MATLAB coding.
The amount of a uniformly distributed radioactive contaminant contained in a closed reactor is measured by its concentration c (Becquerel/litre or Bq/L). The contaminant decreases at a decay rate proportional to its concentration; that is decay ratekc, where k is a constant with units of day1. Given that k- 0.175day1, determine the contaminant concentrations from t-0 to t-5 days with a step size of 0.1 days using: A. Euler's methoo B. Heun's methood...
MATLAB help please!!!!!
1. Use the forward Euler method Vi+,-Vi + (ti+1-tinti , yi) for i=0.1, 2, , taking yo-y(to) to be the initial condition, to approximate the solution at 2 of the IVP y'=y-t2 + 1, 0 2, y(0) = 0.5. t Use N 2k, k2,...,20 equispaced timesteps so to 0 and t-1 2) Make a convergence plot computing the error by comparing with the exact solution, y: t (t+1)2 exp(t)/2, and plotting the error as a function of...
Please
help me with this short, matlab/diffy q project.. teacher said it’s
supposed to be a short code
Matlab Project Recall that we can approximate the time derivative of a function y(t) at time tn as dt ΔΙ This follows from the limit definition of the derivative and gives the approximate slope of the function y(t) at time tn If we think about 'stepping through time from some initial time to a later time in steps of size At, then...
I need help with question 30d
16. y = 0 (that is, y(x) = 0 for all x, also written y(x) = 0) is a solution of (2) (not of (1) if (x) • o , called the trivial solution 17. The sum of a solution of (1) and a solution of (2) is a solution of (1). 18. The difference of two solutions of (1) is a solution of (2). 19. If yı is a solution of (1), what...