regular function integration failure
Afficher commentaires plus anciens
Hello, i have two functions .The first called "fun" (purple in the plot) is integrated great and i get a precise result of 43 from my definite Matlab integral function.
shown in "fun_integral" expression.
The second one called "multiplication_formula" (BLUE in the plot) when goes into the same integration explodes and i get NAN in the "mult_integral expression.
Why is that? please help me understand where did i go wrong applying the integration of "multiplication_formula" .
I have the code bellow and csv file attached.
Thanks.
%Default Dataset_new file
data = load('Default Dataset4.csv');
x = data(:,1);
y = data(:,2);
%plot(x,y);
data_x1=x*0.000001; %transform to micron
[data_k, index] = unique(data_x1);
coef_fun = @(lambda) interp1(data_k, y(index), lambda); %%%%FIRST FUNCTION
%lambda = linspace(3.5e-6,23e-6,100000);
%plot(lambda, coef_fun(xq))
%title('interp1')
multiplication_formula=@(lambda)fun(lambda).*coef_fun(lambda);
lambda = linspace(3.5e-6,23e-6,100000);
plot(lambda, multiplication_formula(lambda));
hold on
plot(lambda,fun(lambda),'blue');
hold off
fun_integral= integral(fun,3.5e-6,23.5e-6)/10;
mult_integral= integral(multiplication_formula,3.5e-6,23.5e-6)/10;
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!