How to plot a 2D graph using all the for loop values؟
Show older comments
clc,clear
xi=input('The solution gas-oil ratio(Rsb)\n');
yi=input( ' The specific gravity of separator gas\n');
Ti=input('reservoir temperature\n');
pi=input('reservoire pressure\n');
zi=input('API of stock tank\n');
Xi=(.013098*Ti^.282372)-(8.2*10^-6*zi^2.176124);
pb=1091.47*(xi^.081465*yi^-.161488*10^Xi-.740152)^5.35489;
fprintf('%s\n%d\n','pb',pb);
fprintf('%4s%15s%20s\n','pi','Co','D');
for ni=1000:1000:10000
n=0;
pi=n+ni;
if pi>=pb
RS=xi;
Co=(-1433+5*xi+2.902*Ti+1.327*yi+12.61*zi)/(10^5*pi);
Apo=52.8-0.01*xi;
for ki=1:100
Aa=-49.893+85.0149*yi-3.70373*yi*Apo+.0479*yi*Apo^2+2.98914*Apo-0.035688*Apo^2;
bpo=(xi*yi+4600*zi)/(73.71+(xi*yi/Aa));
end
Ci=bpo+(.167+16.181*(10^(-0.0425*bpo)))*(pi/1000)-.01*(.299+263*(10^(-0.0603*bpo)))*(pi/1000)^2;
zai=Ci-(0.00302+1.505*Ci^-.951)*(Ti-60)^.938+(.0233*(10^-0.0161*Ci))*(Ti-60)^.475;
fprintf('%4d %15d%20d\n',pi,Co,zai);
end
end
plot(p,Co);
3 Comments
Amr Hashem
on 31 Jul 2015
what is the error you get?
try to attach a sample (image), for better illustration.
Mostafa Shehab
on 2 Aug 2015
Walter Roberson
on 2 Aug 2015
A sample of what you would like the plot to look like would be useful. But you can fix the problem about only plotting one point by making the change I showed in my Answer.
Accepted Answer
More Answers (0)
Categories
Find more on Interactions, Camera Views, and Lighting 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!