Error due to integration

1 Ansicht (letzte 30 Tage)
Ram Rapaka
Ram Rapaka am 10 Jul. 2023
Kommentiert: Ram Rapaka am 10 Jul. 2023
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);

Akzeptierte Antwort

Torsten
Torsten am 10 Jul. 2023
%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

Weitere Antworten (1)

Jon
Jon am 10 Jul. 2023
Bearbeitet: Jon am 10 Jul. 2023
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.

Kategorien

Mehr zu Particle & Nuclear Physics finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by