Second Order Ordinary Differential Equation Array
Show older comments
Hi. A thought never occurred to me about how to approach graphing multiple ordinary differential equations simultaneously while changing a parameter (in an array).
Here is my function code:
function h = manometer(t,y)
rho = 1.2; %Density(g/cm^3)
g = 981; %Gravitational acceleration (cm/s^2)
L = 250; %Liquid length in the manometer (cm)
mu = 0.0097; %Viscosity of the fluid (g/cm/s)
D = [0.1 0.2 0.35]; %Diameter of the pipe (cm) for 1st, 2nd, and 3rd cases
Y = 10; %Deviation variable in the change of the depth in cm (dP/(rho*g))
h(1)=y(2);
h(2)=(3*g*Y/(2*L))-(24*mu*y(2)/(rho.*D.^2))-(3*g*y(1)/(2*L));
h = h';
Hre is my Script File:
t = [0 20];
initial = [0, 0];
[t,y] = ode45(@manometer, t, initial);
plot(t,y(:,1))
Accepted Answer
More Answers (1)
Matthew Tom
on 5 Apr 2019
0 votes
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!