Hi, I am having some trouble with a plot. I am trying to plot pressure vs. time using an equation for pressure with respect to time. Whenever I plot this I get a blank graph, so i'm not sure what the problem is. I appreciate any help!

8 ビュー (過去 30 日間)
Sarah Fries
Sarah Fries 2020 年 9 月 27 日
編集済み: VBBV 2024 年 8 月 6 日
Po = 400000;
Patm = 101325;
rhowater = 1000;
Vo = .00133333;
Anoz = pi*(.010668)^2;
syms P t
P = Po + (((-1.4*P*((P/Po)^(5/7)))/Vo)*(Anoz*sqrt((P-Patm)/rhowater)))*t;
Eqn = solve(P,t);
Peq = Eqn;
fplot(Peq,[0 1])
ylim ([0 450000])
xlabel('time (s) ')
ylabel('Pressure (Pa) ')

回答 (2 件)

VBBV
VBBV 2024 年 8 月 6 日
編集済み: VBBV 2024 年 8 月 6 日
@Sarah Fries Try using the vpasolve function and solve the equation for well defined input time interval. In your code, you were trying to solve the equation for time variable, and contains two unknown variables, i.e. P and t the first variable is Pressure, which needs to be evaluated (solved) while the second variable is just time which can be defined arbitrarily to check how the pressure varies with time.
Po = 400000;
Patm = 101325;
rhowater = 1000;
Vo = .00133333;
Anoz = pi*(.010668)^2;
t = 0:1:20; % define a time vector
syms P
for k = 1:numel(t)
eqn = P-(Po + (((-1.4*P*((P/Po)^(5/7)))/Vo)*(Anoz*sqrt((P-Patm)/rhowater))).*t(k))==0;
sol(k) = vpasolve(eqn,P); % try with vpasolve
end
% use the simple plot function
plot(t,double(sol))
ylim ([0 450000]); grid
xlabel('time (s) ')
ylabel('Pressure (Pa) ')

madhan ravi
madhan ravi 2020 年 9 月 27 日
編集済み: madhan ravi 2020 年 9 月 27 日

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by