Height vs Time Plot with Variable
Afficher commentaires plus anciens
Hi,
I have a Height vs Time plot for a tank which has 1 inlet and 2 outlets. I want to plot Height v Time with multiple lines with varying alpha values. I have created the code to plot the line for 1 alpha value but am unsure how to add multiple lines to show different values. The alpha values will be 0.01:0.01:0.2.
Any help will be much appreciated.
function dhdt = G_20_tankf1(t,h)
% G_20_tankf1: Tank level model
%Derivative function solution for Method 1
% Tank model parameters and chonstants
A = 8.0; %M^2
CV1 = 2; %(m^3/min)/(kPa^0.5)
P0 = 100; %kPa
P1 = P1function(t); %kPa
P3 = 100; %kPa
rho = 1000; %kg/m^3
g = 9.81; %m/s^2
alpha = 0.01;
% Algebraic equations for F1, F2, P2 and CV2 have been substituted
% into the differential equation for dh/dt to create a pure ODE system:
dhdt = 1/A*(CV1*sqrt(P1-P0-rho*g*h/1000) - 3*h*sqrt(P0+rho*g*h/1000-P3) - alpha*g*h);
% G_20_tanksim1: Method 1
%Extra Parameters
tf = 72; %h
h0 = 2 ; %m
% Solve the DAE
opts = odeset('RelTol',1e-5);
[t,h] = ode45(@G_20_tankf1,[0 tf],h0,opts);
% plot the graph
plot(t,h)
title('G20tanksim1')
xlabel('Time (h)')
ylabel('Level (m)')
grid on
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur General Applications dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!