Integral with scalar input
Show older comments
Hi,
I am trying to integrate a function which I can't write easily for vector input, I only wrote it for scalar input.
I have been trying to use integral, either without options (the default should be, according to the documentation, 'ArrayValued', false), and by explicitly setting 'ArrayValued', false.
But the algorithm seems to always input vector to the function to be integrated. When it is debugged, I can indeed see that the size of the argument was (1,150):
prob_ISI1=@(One_del_sp_in_s)(comp_sngleS_given_SurvParts_meth1(One_del_sp_in_s,Exp_etaPr_tp,ints,delay_independent_jumps_inBins,dt,partial_cvnient_vect,tot_jump,frst_tot_jump_corr));
mat_value_totInt_ISIpdf(o,1)=integral(prob_ISI1,0,Inf,'RelTol',0,'AbsTol',1e-12,'ArrayValued',false);
Error using <
Matrix dimensions must agree.
Error in comp_sngleS_given_SurvParts_meth1 (line 13)
last_jmp=find(ints<(One_del_sp_in_s/dt),1,'last');
Error in
comp_num_Intgrl_ISIpdf_overalls_3meths>@(One_del_sp_in_s)(comp_sngleS_given_SurvParts_meth1(One_del_sp_in_s,Exp_etaPr_tp,ints,delay_independent_jumps_inBins,dt,partial_cvnient_vect,tot_jump,frst_tot_jump_corr))
(line 140)
prob_ISI1=@(One_del_sp_in_s)(comp_sngleS_given_SurvParts_meth1(One_del_sp_in_s,Exp_etaPr_tp,ints,delay_independent_jumps_inBins,dt,partial_cvnient_vect,tot_jump,frst_tot_jump_corr));
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 133)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 84)
[q,errbnd] = vadapt(@AToInfInvTransform,interval);
Error in integral (line 89)
Q = integralCalc(fun,a,b,opstruct);
Error in comp_num_Intgrl_ISIpdf_overalls_3meths (line 142)
mat_value_totInt_ISIpdf(o,1)=integral(prob_ISI1,0,Inf,'RelTol',0,'AbsTol',1e-12,'ArrayValued',false);
Error in main_BigFluct (line 59)
comp_num_Intgrl_ISIpdf_overalls_3meths(mn_step,std_step,dur_step,observed_ISIs,max_ISI,eta,dt,times_center_subjumps,rootsavedir,'')
size(One_del_sp_in_s)
ans =
1 150
Do you know how to fix this ? I am using Matlab R2013a
Laureline
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differentiation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!