Error due to integration

4 visualizaciones (últimos 30 días)
Ram Rapaka
Ram Rapaka el 10 de Jul. de 2023
Comentada: Ram Rapaka el 10 de Jul. de 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);

Respuesta aceptada

Torsten
Torsten el 10 de Jul. de 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

Más respuestas (1)

Jon
Jon el 10 de Jul. de 2023
Editada: Jon el 10 de Jul. de 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.

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by