Error due to integration
조회 수: 1 (최근 30일)
이전 댓글 표시
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);
댓글 수: 0
채택된 답변
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)
댓글 수: 0
추가 답변 (1개)
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!