Trying to do calculations for density
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sean St Cyr
il 1 Lug 2020
Commentato: Sean St Cyr
il 1 Lug 2020
%% Variables
% Input
% P_t - Total pressure [atm]
% P_s - Surface pressure [atm]
% H - Height [ft]
% Output
% rho - Density [kg/m^3]
% Other
% g - Gravity [m/s^2]
% Write your entire function code below here (Including header)
function [Rho] = RQ16_18(P_t,P_s,H) % The order of input variables should be Total Pressure, Surface Pressure, and Height
% Constants
P_t=4;
P_s=3;
H=25;
% Calculations
H = H/3.281; %Convert Ft to Meters
Tp = P_t * 101325; %Convert Atm to Pascals
Sp = P_s * 101325; %Convert Atm to Pascals
g = 9.8; %gravity
Rho = (Tp - Sp)/(g*H); %Density
end
I am trying to get the density and its defined as Rho however when matlab grader grades it it says the value is wrong. Am I missing a conversion? or Caluclation?
0 Commenti
Risposta accettata
James Tursa
il 1 Lug 2020
Why do you have these lines in your function:
P_t=4;
P_s=3;
H=25;
Aren't these variable supposed to be input arguments? Seems like you should delete these lines since they overwrite the input arguments.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Calculus in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!