clear; clc; close all
% Part A: water
R = .5; %ft
L = 30; %ft
cP = 1.32/12; %psi/ft
mu = 578/12; %lbm/(ft*s)
r = linspace(0,R,100); %m^3*atm/(kg-mol*K)
v_r = ((-R^2)/(4*mu))*(cP/L)*(1-((r.^2)/(R^2)));
% integration
Iv_r = (trapz(R,v_r.*r));
Vtop_avg= 2*pi*Iv_r;
Vbot_avg= pi*R^2;
V_avg= (Vtop_avg)/(Vbot_avg)
% Part B: for MIL-M-5606 hydraulic fluid
R = .5; %ft
L = 30; %ft
cP = 1.32/12; %psi/ft
mu = 6.95e7/12; %lbm/(ft*s)
r = linspace(0,R,100); %m^3*atm/(kg-mol*K)
v_r = ((-R^2)/(4*mu))*(cP/L)*(1-((r.^2)/(R^2)));
% integration
Iv_r = (trapz(R,v_r.*r));
Vtop_avg= 2*pi*Iv_r;
Vbot_avg= pi*R^2;
V_avg= (Vtop_avg)/(Vbot_avg)
The avgs should be 304 and .0025 but I am not getting those values

댓글 수: 3

All we see is the code, which does not produce the wanted result. There is no chance to find a problem, because we do not have any information about what you want to solve. I do not even know, what "The avgs" are.
So curently the question is equvalent to:
a = 2;
b = 3;
c = a+ b;
% I get the result 5, but I need to get 17.3.
So please edit the question and provide the details.
Star Strider
Star Strider 2019년 4월 1일
If you have a PDF of the equations you’re using and the integrations, attaching it would help. Your code runs without error, so that means you haven’t coded your equations correctly.
Torsten
Torsten 2019년 4월 2일
Iv_r = trapz(r,v_r.*r);
instead of
Iv_r = (trapz(R,v_r.*r));
Best wishes
Torsten.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Profile and Improve Performance에 대해 자세히 알아보기

태그

질문:

2019년 4월 1일

댓글:

2019년 4월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by