Question

In: Computer Science

The ideal gas law can be stated as P V = nRT where P = pressure...

The ideal gas law can be stated as P V = nRT where P = pressure in Pascals (Pa) V = volume in cubic meters (m3 ) n = number of moles in moles (mol) R = gas constant = 8.3145m3 Pa / ( K · mol ) T = temperature in Kelvin (K). Using MATLAB or Octave, Write a script that prompts the user for the pressure, the volume, and the temperature; storing each in a variable. The script should then calculate the number of moles, saving it to a variable, and print the result. Sample output: Enter the pressure in Pascals: 101.3 Enter the volume in cubic meters: 3.5 Enter the temperature in Kelvin: 301 A gas with pressure 101.30 Pa, volume 3.50 mˆ3, and temperature 301.00 K has 0.14 moles Enter the pressure in Pascals: 98.1378 Enter the volume in cubic meters: 10 Enter the temperature in Kelvin: 250.2 A gas with pressure 98.14 Pa, volume 10.00 mˆ3, and temperature 250.20 K has 0.47 moles

Solutions

Expert Solution

Screenshot of the code:

Sample Output:

//Sample Run 1:

//Sample Run 2:

Code To Copy:

%Prompt the pressure, temperature and volume.
Pressure = input("Enter the pressure in Pascals: ")
Volume = input("Enter the volume in cubic meters: ")
Temperature = input("Enter the temperature in Kelvin: ")

%Define the gas constant.
R = 8.3145;

%Compute the moles.
n = (Pressure .* Volume)/(R .* Temperature)

%Display the result.
fprintf("A gas with pressure %.2f Pa, volume %.2f mˆ3, and temperature %.2f K has %.2f moles", Pressure, Volume, Temperature, n)


Related Solutions

The ideal gas law PV=nRT relates pressure P, volume V, temperature T, and number of moles...
The ideal gas law PV=nRT relates pressure P, volume V, temperature T, and number of moles of a gas, n. The gas constant R equals 0.08206 L⋅atm/(K⋅mol) or 8.3145 J/(K⋅mol). The equation can be rearranged as follows to solve for n: n=PVRT This equation is useful when dealing with gaseous reactions because stoichiometric calculations involve mole ratios. Part A When heated, calcium carbonate decomposes to yield calcium oxide and carbon dioxide gas via the reaction CaCO3(s)→CaO(s)+CO2(g) What is the mass...
I have 5 chemistry questions here. The Ideal Gas Equation states: PV = nRT where "P"...
I have 5 chemistry questions here. The Ideal Gas Equation states: PV = nRT where "P" equals the pressure of the gas, "V" equals the volume of the container, "n" equals the number of moles of gas in the container, R = the Gas constant (0.082057 L atm K–1 mol–1), and "T" equals the temperature of the gas 1. Calculate the volume (in litres) of a sealed container with 5.67 mol of an ideal gas at a temperature of 374.7...
I need A and C ± Changes in Volume The ideal gas law (PV=nRT) describes the...
I need A and C ± Changes in Volume The ideal gas law (PV=nRT) describes the relationship among pressure P, volume V, temperature T, and molar amount n. When some of these variables are constant, the ideal gas law can be rearranged in different ways to take the following forms where k is a constant: Name Expression Constant Boyle's law PV=nRT=k n and T Charles's law VT=nRP=k n and P Avogadro's law Vn=RTP=k T and P Part A A certain...
One mole of an ideal gas undergoes a process where the pressure varies according to P...
One mole of an ideal gas undergoes a process where the pressure varies according to P = (-17.0 atm/m6) V2 + (32.5 atm/m3) V + 1.80 atm where V is the volume. The volume initially starts at 0.0265 m3 and ends at a value of 1.05 m3. Generate an accurate P-V graph for this situation. Determine the initial and final temperatures for this situation. Determine the change in internal energy for this situation. Determine the work done for this situation....
Use the ideal gas law to complete the table: P V n T 1.06 atm 1.25...
Use the ideal gas law to complete the table: P V n T 1.06 atm 1.25 L 0.105 mol ___ 115 torr ___ 0.249 mol 309 K ___ 28.2 mL 1.81×10−3 mol 26.0 ∘C 0.565 atm 0.440 L ___ 257 K
The pressure p and volume v of a given mass of gas are connected by the...
The pressure p and volume v of a given mass of gas are connected by the relation k=(p+a\v^2)(v-b) where a, b, and k are constants. Using the composite trapezoidal method, write a MatLab script to approximate the work done by the gas in expanding from an initial volume to a final volume. Express p in terms of v. Where W = Integral (Pdv)
Using the ideal gas law, explain how the gas pressure sensor must work for the vernier...
Using the ideal gas law, explain how the gas pressure sensor must work for the vernier labquest.
One mole of an ideal gas in an initial state P = 10atm, V = 5L,...
One mole of an ideal gas in an initial state P = 10atm, V = 5L, is taken reversibly in aclockwise direction around a circular path given by (V − 10)^2 + (P − 10)^2 = 25. Computethe amount of work done by the gas and the change in internal energy.
1 Ideal Gas Law The ideal gas law is familiar to anyone who has taken a...
1 Ideal Gas Law The ideal gas law is familiar to anyone who has taken a college chemistry course: P V = νRT. This problem will show you why the ideal gas law has this form. We can arrive at this expression just by using classical mechanics! Consider a box of volume V containing N particles, each having mass m, that are moving horizontally with average speed v. The particles bounce back and forth between the end walls of the...
For Van Der Waals equation (P + a/V2)(V - b) = nRT How can you find...
For Van Der Waals equation (P + a/V2)(V - b) = nRT How can you find the values of "a" and "b" using an experiment? Please explain the method of the experiment too
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT