calculating an integral of complex function substituting data from excel
Mostrar comentarios más antiguos
I have an excel data whose components are all numbers ranging from 2.9 to 3(ex) 2.90234 2.90343 ~ 2.98021).
I want to import these data as variable 'e'. Also, I have other parameters and substituting those values including 'e', I want to get a series of resulting values of 'I' and eventually plot them. However, when I run the code below, I get NaN for 'I' for every data. What should I do?
x = 3.01;
k = 8.62*10^-5;
T = 160;
a = 0.2;
fun = @(x,k,T,a,b,e) exp(-b.^2./(2.*a.^2)).*heaviside(x-b-e).*exp(-(x-b-e)./(k.*T));
I = integral(@(b) fun(x,k,T,a,b,e),0,Inf)
%plot(e,I)
1 comentario
dpb
el 18 de En. de 2021
>> x = 3.01;
k = 8.62*10^-5;
T = 160;
a = 0.2;
fun = @(x,k,T,a,b,e) exp(-b.^2./(2.*a.^2)).*heaviside(x-b-e).*exp(-(x-b-e)./(k.*T));
e=2.903;fun(x,k,T,a,b,e)
Unrecognized function or variable 'b'.
>>
so you're missing more than just e
Use readmatrix or similar to read the spreadsheet.
Then, of course, check that your function actually produces what you expect it to for a range of cases first...
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Spreadsheets en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


