Question

Hi, im trying to program a simple iteration in matlab to solve a bubbel point temparture....

Hi, im trying to program a simple iteration in matlab to solve a bubbel point temparture. I tried to do a loop so i dont have to do all calculation separatly. Sadly i am not a god programmer so i need some help with that! What i want to achive is that for every T from 87 to 97 i want matlab to compute P1 and P2. The P1 and P2 are then used to calculate y1 which then is used to calculate y2. I want matlab to do this until it findes a value of T such that abs(y1+y2)<tol where tol is some smal number. After that i want matlab to spit out the value of y1 and T that generated the answer. I tried do to it whit a while loop but i dont work.

A=8.0842;
B=1581.5;
a=7.9668;
b=1668.21;
C=225.10;
c=228;
x1=0.3;
x2=0.7;
P=760;
T=linspace(87,0.2,97);
P1=exp(A-(B./(C+T)));
P2=exp(a-(b./(c+T)));
y1=P1.*x1./P;
y2=(1-y1);
tol=10^-3;
while abs(y1-y2)>tol
if (abs(y2-y1))<tol
break
  
end
end
y1

T

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

Note: Brother according to the formula. it never gets below tolerance since y1 is very close to 0.9 every time so y2 is very close to 0.1 everytime.

clear all
clc
A=8.0842;
B=1581.5;
a=7.9668;
b=1668.21;
C=225.10;
c=228;
x1=0.3;
x2=0.7;
P=760;
for T=87:0.01:97
P1=exp(A-(B./(C+T)));
P2=exp(a-(b./(c+T)));
y1=P1.*x1./P;
y2=(1-y1);
tol=10^-3;
if (abs(y2-y1))<tol
break
end
end
y1

T

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Hi, im trying to program a simple iteration in matlab to solve a bubbel point temparture....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MATLAB ONLY!! PLEASE WRITE IN COMPUTER SO I CAN COPY PASTE!!! ANSWER COMPLETELY, USE FOR LOOPS....

    MATLAB ONLY!! PLEASE WRITE IN COMPUTER SO I CAN COPY PASTE!!! ANSWER COMPLETELY, USE FOR LOOPS. THE PROGRAM TO BE MODIFIED IS THE NEXT ONE: clc clear % Approximate the value of e ^ x using the Taylor Series x = input( 'Enter the value of x for e^x. x = ' ); t = input( 'Enter the amount of desired terms. t = ' ); i = 1; e_taylor = 0; % initializing the variable for the accumulator while...

  • MATLAB only please I am trying to get my getdatafuntion to work. I am also trying to get all my x...

    MATLAB only please I am trying to get my getdatafuntion to work. I am also trying to get all my x's, y's, and v's to popup in the command window so I can put in any value and it will find the value for me using the equation I put in. function project_9_sjl() % PROJECT_9_SJL project_9_sjl() is the driver function for the program. % %    Name: Scott Lawrence %   Date: 3/27/2019 %   Class: CMPSC 200 %   Description: Determine the optimal...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT