Error due to integration

2 ビュー (過去 30 日間)
Ram Rapaka
Ram Rapaka 2023 年 7 月 10 日
コメント済み: Ram Rapaka 2023 年 7 月 10 日
Getting an error for the integration showig
filename ='Torque.xlsx';
sheet = 'Averages';
A = readtable(filename,'Sheet',sheet,'Range','A3:L32');
A = table2array(A);
% Parameters
P_n=31.5*10^6;
omg=37.18;
U=0.001;
C_f = 0.31;
x=1;
syms r
sig_y=(289.611 * exp(-(A(x,1) - 347.26)^2 / (2 * 165.41^ 2)))*10^6;
tou_y=sig_y/sqrt(3);
delta = @(r) C_f * exp((r * omg) / 1.87) - 0.026;
mu_f = @(r) 0.5 / exp(delta(r) .* (r * omg));
stk = @(r) (1 - delta(r)) .* tou_y;
slp = @(r) delta(r) .* mu_f(r) .* P_n;
sol= @(r) (stk(r) + slp(r)) .*(2*pi*r^2);
min=0.006+0.00066666678*(x-1);
max=0.006+0.00066666678*(x);
z= integral(sol,min,max);

採用された回答

Torsten
Torsten 2023 年 7 月 10 日
%filename ='Torque.xlsx';
%sheet = 'Averages';
%A = readtable(filename,'Sheet',sheet,'Range','A3:L32');
%A = table2array(A);
% Parameters
P_n=31.5*10^6;
omg=37.18;
U=0.001;
C_f = 0.31;
x=1;
%syms r
A(x,1) = 345;
sig_y=(289.611 * exp(-(A(x,1) - 347.26)^2 / (2 * 165.41^ 2)))*10^6;
tou_y=sig_y/sqrt(3);
delta = @(r) C_f * exp((r * omg) / 1.87) - 0.026;
mu_f = @(r) 0.5 ./ exp(delta(r) .* (r * omg));
stk = @(r) (1 - delta(r)) .* tou_y;
slp = @(r) delta(r) .* mu_f(r) .* P_n;
sol= @(r) (stk(r) + slp(r)) .*(2*pi*r.^2);
min=0.006+0.00066666678*(x-1);
max=0.006+0.00066666678*(x);
z= integral(sol,min,max)
z = 19.7585

その他の回答 (1 件)

Jon
Jon 2023 年 7 月 10 日
編集済み: Jon 2023 年 7 月 10 日
I don't have your Excel file to test your code, but it looks like your problem is that the function given to integral, in your case sol, must accept vector inputs. So check all of your multiplications and especially divisions to make sure you using ./ and .* as appropriate to do element by element multiplication and division. Looks like you have some / where you should have ./
Please attach your .xlsx input file if you still need more help.
  1 件のコメント
Ram Rapaka
Ram Rapaka 2023 年 7 月 10 日
Thank you

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeParticle & Nuclear Physics についてさらに検索

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by