Error due to integration
2 次查看(过去 30 天)
显示 更早的评论
Getting an error for the integration showig
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1431308/image.jpeg)
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!