Help with this Integration problem
显示 更早的评论
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 个评论
Jan
2019-4-1
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
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
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 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!