Question
Numerical method question
7. Write a script as a user-defined function with the function name of Cal Press [YOUR WSU IDI, to determine the gas pressqre of the system, p [Pa], using the ideal gas law for given volume V[m], temperature, T[K], molé, N. NOTE: you need to save this script as Cal_Press_lYOUR WSU ID].m. You may want to review an article to solve the problem https://en.wikipedia.org/wiki/Ideal_gas_law). Use V 0.1 m3, T- 300 K, N- 1 mole (2 pt) emplate for the Octave (or Matlab) function writing in a script editor function p = Cal-Press-tYOUR WSU IDI (V, T, N) [YOUR SCRIPT SHOULD BE GIVEN HERE end Template for the Octave (or Matlab) function calling in a command window >> Vー0.1 İ Tー300, N-l ; p-cal Press [YOUR wsU IDI(V, T. N) <enter>
0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB script for function

function p=Cal_Press_ID(V,T,N)

R=8.314;

p=(N*R*T)/V;

end

% Script for calling above function

clc

clear

close all

V=0.1;T=300;N=1;

p=Cal_Press_ID(V,T,N)

% Result

2.4942e+04

Add a comment
Know the answer?
Add Answer to:
Numerical method question 7. Write a script as a user-defined function with the function name of...
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
  • 3) Develop a Matlab function to compute the velocity v of a particular projectile as a...

    3) Develop a Matlab function to compute the velocity v of a particular projectile as a function of time t. In this problem, the velocity profile is described by a piecewise function, and is parameterized by 11 parameters, a, b, c, d, g, h, k, m, n, p, and q, as at - bt, 05158 c-dt, 851516 v(t;a,b,c,d,g,h,k,m,n, p,q) = gt +h(t – k)?, 1651526 me=n(t-p), > 26 else. Your Matlab function must take as input the current time value...

  • The pressure, P in atmospheres (atm), of an ideal gas can be expressed as a function...

    The pressure, P in atmospheres (atm), of an ideal gas can be expressed as a function of volume, V in liters (L), and temperature, T in kelvin (K), is P(V, T) = nRT/V where n = 1 mol and R 0.08 are constants. Suppose the current volume and temperature of a gas behaving according to the ideal gas law are: V = 5 L and T = 300 K. (a) Compute the differential (or, equivalently, approximate DeltaP) for the given...

  • Code to Matlab Make two plots on one page. mo ad tle veloclty as a function...

    Code to Matlab Make two plots on one page. mo ad tle veloclty as a function of time for 0sts4s. 33 The ideal gas equation states that PV RT 400 En van der Waals equation where P is the pressure, V is the volume, T is the temperature, R 0.08206 (L atm) (mol K) is the gas constant, and n is the number of moles. Real gases, especially at high pressures, deviate from this behavior. Their response can be modeled...

  • Please don't attempt if you can not write a MATLAB PROGRAM. I don't need numerical physics...

    Please don't attempt if you can not write a MATLAB PROGRAM. I don't need numerical physics solution, I need MATLAB code. Read the question carefully 2) Falling Drops Imagine a solid sphere of diameter, d, falling through the air. After its release, the sphere accelerates until it reaches its terminal velocity. The terminal velocity is obtained when the drag force due to air friction, Fa, balances the weight of the sphere, W. The weight of the sphere is simply its...

  • Hi, Really struggling to get my head around this question Could you please provide an explanation...

    Hi, Really struggling to get my head around this question Could you please provide an explanation with your working. Trying to better understand what's being asked. Would really appreciate it if you could explain your working. I am happy with my answer to part a), but can't understand where to start in part b) Many thanks! Question 2 The ideal gas law relates the temperatueresure, and the temperature, pressure, and volume of an ideal gas. For n moles of gas,...

  • 2. (15 marks) The van der Waals equation (first introduced by van der Waals in 1877) is an attemp...

    2. (15 marks) The van der Waals equation (first introduced by van der Waals in 1877) is an attempt to describe the fact that real gases do not follow the ideal gas law. According to this equation where P is the pressure of the gas, V is the volume, R is the gas constant, T is the temperature, n is the number of moles, and a and b are parameters that depend on the gas (a) Suppose that 1.0 ±...

  • T(N)=352 please I need the answer urgent Question 1 The following gas phase reaction produces ethanol...

    T(N)=352 please I need the answer urgent Question 1 The following gas phase reaction produces ethanol (C2H5OH) by catalytic hydrogenation of acetaldehyde (CH3CHO). The reaction reaches equilibrium at a temperature of T= T(N) and a pressure of 3 bar: CH,CHO(g) + H, (g) C,H,OH (8) The reactive system initially contains 1.5 moles of Hydrogen (Ha) for each mole of acetaldehyde (CH3CHO). The mixture is assumed to be an ideal gas. T(N) is the temperature corresponding to the student number as...

  • Can you please help me with this question. Much appreciated. So I have a sample code,...

    Can you please help me with this question. Much appreciated. So I have a sample code, but we need to change the code in a way that fits the problem. A planar slab of material is initially at a temperature of 300 K. At the time t=0, microwave radiation is directed at the material, leading to internal heat generation that is uniform within the material. The sides of the slab experience negligible heat losses and a water bath maintains the...

  • I wonder how to a problem 5.13. This problem is related to applied numerical methods with Matlab(third edition). I want Matlab code. 5.13 Figure P5.13a shows a uniform beam subject to a lin- early...

    I wonder how to a problem 5.13. This problem is related to applied numerical methods with Matlab(third edition). I want Matlab code. 5.13 Figure P5.13a shows a uniform beam subject to a lin- early increasing distributed load. The equation for the result- ing elastic curve is (see Fig. P5.13b) htm U) (P5.13) 3 3" Use bisection to determine the point of maximum deflection (i.e, the value of x where dy/dx 0). Then substitute this value into Eq. (P5 13) to...

  • ANSWER PART B, I HAVE PART A. MATLAB ONLY!! WRITE IN COMPUTER SO I CAN COPY...

    ANSWER PART B, I HAVE PART A. MATLAB ONLY!! WRITE IN COMPUTER SO I CAN COPY PASTE!! The student must use the following case provided and apply most of the commands leared in the previous modules. You should use the command folder that you must be expanding with each module. Case (Gilat, 2015): The concentration of a drug in the body Cp can be modeled by the equation: Doka (e-ketek) Va (ka-k) Where Do is the dosage administrated (mg). Ve...

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
ADVERTISEMENT