Use Heun's Method please! Must use MATLAB and please use ANONYMOUS function. WIll rate answer 5 stars if done correctly.
MATLAB Script:
close all
clear
clc
% Give: y'' = (f/(2EI))*(L-z)^2
% Letting y' = u
% u' = y'' = (f/(2EI))*(L-z)^2
% We now have a system of first-order ODEs
L = 30; E = 1.25e8; I = 0.05;
h = 1;
zi = 0; zf = L;
n = (zf - zi)/h;
z = zi:h:zf;
y(1) = 0; u(1) = 0; % Initial conditions
for i=1:n
m1 = dydz(z(i), y(i), u(i));
n1 = dudz(z(i), y(i), u(i));
m2 = dydz(z(i) + h, y(i) + h*m1, u(i) + h*n1);
n2 = dudz(z(i) + h, y(i) + h*m1, u(i) + h*n1);
y(i+1) = y(i) + 0.5*h*(m1 + m2);
u(i+1) = u(i) + 0.5*h*(n1 + n2);
end
% Exact Solution
syms y_exact(z_exact)
Dy = diff(y_exact, z_exact);
eqn = diff(y_exact, z_exact, 2) == (200*z_exact*exp(-2*z_exact/30)
/ (5 + z_exact)) * (L - z_exact)^2 / (2*E*I);
conds = [y_exact(0) == 0, Dy(0) == 0];
sol_y = dsolve(eqn, conds);
% Plot the solutions
figure, plot(z, subs(sol_y, z)), hold on
plot(z, y, '-o'), xlabel('z'), ylabel('y(z)')
legend('Exact Solution', 'Using Heun''s Method');
function f = dydz(~,~,u)
f = u; % y'
end
function out = dudz(z,~,~)
L = 30; E = 1.25e8; I = 0.05;
f = @(z) 200*z*exp(-2*z/30) / (5 + z);
out = (f(z)/(2*E*I))*(L-z)^2; % u'
end
Output Graph (Along with Exact Solution):
Use Heun's Method please! Must use MATLAB and please use ANONYMOUS function. WIll rate answer 5 stars if done corre...
MUST USE MIDPOINT METHOD AND ANONYMOUS FUNCTION and MATLAB, no outer function please. Will rate answer 5 stars if done right :) Solve using the midpoint method (RK2), choose a step size The logistic model is used to simulate population as in: Pmax where p -population, kgm -the maximum growth rate under unlimited conditions, and pmax - the carrying capacity. Simulate the world's population from 1950 to 2000 using one of the numerical methods described in this chapter. Employ the...
please answer all pre-lab questions 1 through 5. THANK YOU!!! this is the manual to give you some background. the pre-lab questions.. the pre-lab sheet. Lab Manual Lab 10: String Waves & Resonance Before the lab, read the theory in Sections 1-3 and answer questions on Pre-lab Submit your Pre-lab at the beginning of the lab. During the lab, read Section 4 and follow the procedure to do the experiment. You will record data sets, perform analyses, answer questions, and...