?? solvestartpressureofsinglepipeline.m
字號:
clc;
%clf; %清除圖形,會跳出繪圖窗口
clear;
syms x y
tishi=msgbox('程序開始運行,按任意鍵繼續');
pause;
Z=input('Please input 壓縮因子Z=');
T=input('please input 平均溫度(K)T=');
delt=input('please input 相對密度Δ=');
D=input('please input 管徑(m)D=');
K=Z.*delt.*T/(0.393.^2.*D^5.2);%前蘇聯近期公式
Q=input('please input 起點輸氣量(m3/d)Q=')./3600./24;
Pz=input('please input 末點壓力(MPa)Pz=').*10.^6;
n=0;%input('請輸入共有分氣點個數,n>=0,如果n=0則認為是一根無分支的管段)n=').*1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%無分支管線
if n<1
L=input('請輸入管段長度(km),L=').*1000;
y=x.^2-Pz.^2-K.*Q.*L;
b=solve(y,x);
PQ=subs(b);
%%%%%%%%%%%%%%%%%%%只取正根
for j=1:2
if PQ(j)>0
c=PQ(j);
end
end
d=c./10.^6;
a=num2str(d);
str=['起點壓力為' a 'MPa'];
PQ=msgbox(str);
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -