Help with this Integration problem
Ältere Kommentare anzeigen
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 Kommentare
Jan
am 1 Apr. 2019
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
am 1 Apr. 2019
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
am 2 Apr. 2019
Iv_r = trapz(r,v_r.*r);
instead of
Iv_r = (trapz(R,v_r.*r));
Best wishes
Torsten.
Antworten (0)
Kategorien
Mehr zu Profile and Improve Performance finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!