how can I make a GUI for this script?

3 ビュー (過去 30 日間)
Mostafa Shehab
Mostafa Shehab 2015 年 12 月 30 日
回答済み: Walter Roberson 2015 年 12 月 30 日
clc,clear
close all
disp('Formation Water Properties');
S=input('Salinity(Weight percent solids)= ');
T=input('The temperature in degrees F = ');
P=input('Pressure in psia = ');
Pb=input('Bubble point Pressure = ');
z=input('Solution Gas Water Ratio at Pb ');
fprintf('%5s %5s %5s %5s %s %5s\n','P','Rsw','Bw','D','cw','Uw');
for i=100:100:P
if i<Pb
P(i)=i;
A0=8.15839; A1=-6.1226510^-2; A2=1.91663*10^-4; A3=-2.1654*10^-7;
A= A0+A1*T+A2*T^2+A3*T^3;
B0=1.01021*10^-2; B1=-7.44241*10^-5; B2=3.0555*10^-7; B3=-2.94883*10^-10;
B=B0+B1*T+B2*T^2+B3*T^3;
C0=-9.02505; C1=0.130237; C2=-8.53425*10^-4; C3=2.34122*10^-6;
C4=-2.37049*10^-9;
C = (C0 + C1*T + C2*T^2 + C3*T^3 + C4*T^4)*(10^-7);
Rsw(i)=A + B* P(i) + C*P(i);
Rswb(i)=Rsw(i)*10^(-0.0840655*S*T^-.285854);
X=-1.0001*(10^-2)+1.3339*(10^-4)*T+5.50654*(10^-7)*T^2;
Y(i)=-1.95301*(10^-9)*P(i)*T -1.72834*(10^-13)*P(i)^2*T-3.58922*(10^-7)*P(i)-2.25341*(10^-10)*P(i)^2;
Bw(i)=(1+Y(i))*(1+X);
mi=62.368+0.438603*S + 1.60074*(10^-3)*S^2;
Aw(i)=mi/Bw(i);
A1 = 7.033; A2 = 0.5415; A3 = -537.0; A4 = 403300;
cw(i)= 1 / (A1*P(i) + A2*S + A3*T + A4);
A0=109.574; A1=-8.40564; A2=0.313314; A3=8.72213*10^-3;
A = A0+ A1*S + A2*S^2 + A3*S^3;
B0=-1.12166; B1=2.63951*10^-2; B2=-6.79461*10^-4; B3=-5.47119*10^-5;
B4=1.55586*10^-6;
B = B0 + B1*S + B2*S^2+B3*S^3+B4*S^4;
Uo=A*T^B;
Uw(i)=Uo*(0.9994+4.0295e-05*P(i)+3.1062e-09*P(i)^2);
fprintf('%5d %5.2f %5.2f %5.2f %5d %5.3f\n',P(i),Rswb(i),Bw(i),Aw(i),cw(i),Uw(i));
end
if i>=Pb
P(i)=i;
A0=8.15839; A1=-6.1226510^-2; A2=1.91663*10^-4; A3=-2.1654*10^-7;
A= A0+A1*T+A2*T^2+A3*T^3;
B0=1.01021*10^-2; B1=-7.44241*10^-5; B2=3.0555*10^-7; B3=-2.94883*10^-10;
B=B0+B1*T+B2*T^2+B3*T^3;
C0=-9.02505; C1=0.130237; C2=-8.53425*10^-4; C3=2.34122*10^-6;
C4=-2.37049*10^-9;
C = (C0 + C1*T + C2*T^2 + C3*T^3 + C4*T^4)*(10^-7);
Rsw(i)=A + B* P(i) + C*P(i);
Rswb(i)=Rsw(i)*10^(-0.0840655*S*T^-.285854);
X=-1.0001*(10^-2)+1.3339*(10^-4)*T+5.50654*(10^-7)*T^2;
Y(i)=-1.95301*(10^-9)*P(i)*T -1.72834*(10^-13)*P(i)^2*T-3.58922*(10^-7)*P(i)-2.25341*(10^-10)*P(i)^2;
Bw(i)=(1+Y(i))*(1+X);
mi=62.368+0.438603*S + 1.60074*(10^-3)*S^2;
Aw(i)=mi/Bw(i);
A1 = 7.033; A2 = 0.5415; A3 = -537.0; A4 = 403300;
cw(i)= 1 / (A1*P(i) + A2*S + A3*T + A4);
A0=109.574; A1=-8.40564; A2=0.313314; A3=8.72213*10^-3;
A = A0+ A1*S + A2*S^2 + A3*S^3;
B0=-1.12166; B1=2.63951*10^-2; B2=-6.79461*10^-4; B3=-5.47119*10^-5;
B4=1.55586*10^-6;
B = B0 + B1*S + B2*S^2+B3*S^3+B4*S^4;
Uo=A*T^B;
Uw(i)=Uo*(0.9994+4.0295e-05*P(i)+3.1062e-09*P(i)^2);
fprintf('%5d %5.2f %5.2f %5.2f %5d %5.3f\n',P(i),Rswb(i),Bw(i),Aw(i),cw(i),Uw(i));
end
end
i=100:100:P;
figure('name','p& Rsw ');
plot(P(i), Rswb(i));
xlabel('Pressure');
ylabel('Rsw, scf/STB');
title('p& Rsw ');
figure('name','p& Bw ');
plot(P(i), Bw(i));
xlabel('Pressure');
ylabel('Bw, res bbl/STB');
title('p& Bw ');
figure('name','p& D ');
plot(P(i), Aw(i));
xlabel('Pressure');
ylabel('Dw, lb/cu ft');
title('p& D ');
figure('name','p&Cw');
plot(P(i), cw(i));
xlabel('Pressure');
ylabel('Cw, 1/psi');
title('p& Cw ');
figure('name','p&Uw');
plot(P(i), Uw(i));
xlabel('Pressure');
ylabel('UW,cp');
title('p& Uw ');

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 12 月 30 日
That would depend on what you want the GUI to do.
You can replace your input() calls with inputdlg() (but watch out because that does not return numeric data directly)
See also MAGIC File Exchange contribution and MATLAB's "GUIDE"

カテゴリ

Help Center および File ExchangeFiles and Folders についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by