How do I solve this error?

4 views (last 30 days)
Output of the function must be the same size as the input. If FUN is an array-valued integrand, set the 'ArrayValued' option to
true.
B=3.1e98;
R=8.313;
Ea=6.28e5 ;
Omega=integral (@(t) B* exp(-Ea./(R.* V)),0,1);

Accepted Answer

Star Strider
Star Strider on 9 Sep 2021
The value of ‘Ea’ in the exponential call makes the integral effectively zero of all the values of ‘V’.
LD = load('V[1].mat');
V = LD.V;
V = rmmissing(V)
V = 9×51
38.3783 38.3441 38.2717 38.1677 38.0411 37.9017 37.7593 37.6222 37.4966 37.3865 37.2937 37.2182 37.1586 37.1129 37.0789 37.0541 37.0364 37.0242 37.0158 37.0102 37.0065 37.0042 37.0027 37.0018 37.0012 37.0009 37.0007 37.0006 37.0005 37.0005 38.0424 38.0234 37.9881 37.9382 37.8761 37.8046 37.7268 37.6459 37.5647 37.4857 37.4112 37.3426 37.2810 37.2270 37.1806 37.1415 37.1093 37.0832 37.0625 37.0463 37.0339 37.0245 37.0175 37.0124 37.0088 37.0062 37.0043 37.0031 37.0022 37.0017 37.8743 37.8606 37.8373 37.8051 37.7653 37.7190 37.6677 37.6129 37.5561 37.4989 37.4424 37.3878 37.3362 37.2881 37.2441 37.2046 37.1696 37.1390 37.1128 37.0905 37.0719 37.0565 37.0440 37.0339 37.0259 37.0197 37.0148 37.0111 37.0083 37.0062 37.7683 37.7573 37.7397 37.7162 37.6872 37.6535 37.6159 37.5754 37.5327 37.4888 37.4446 37.4008 37.3582 37.3172 37.2785 37.2424 37.2092 37.1789 37.1517 37.1276 37.1064 37.0880 37.0722 37.0587 37.0474 37.0380 37.0303 37.0240 37.0189 37.0148 37.6935 37.6841 37.6700 37.6514 37.6287 37.6025 37.5731 37.5413 37.5075 37.4724 37.4366 37.4006 37.3649 37.3300 37.2963 37.2642 37.2338 37.2055 37.1794 37.1554 37.1338 37.1143 37.0971 37.0819 37.0686 37.0571 37.0472 37.0388 37.0318 37.0259 37.6371 37.6288 37.6169 37.6015 37.5830 37.5615 37.5376 37.5116 37.4838 37.4548 37.4249 37.3946 37.3642 37.3342 37.3047 37.2762 37.2489 37.2229 37.1984 37.1756 37.1545 37.1351 37.1175 37.1016 37.0873 37.0747 37.0635 37.0537 37.0452 37.0379 37.5926 37.5851 37.5748 37.5616 37.5459 37.5278 37.5077 37.4858 37.4623 37.4377 37.4122 37.3862 37.3599 37.3337 37.3078 37.2824 37.2577 37.2340 37.2114 37.1900 37.1699 37.1511 37.1337 37.1178 37.1032 37.0900 37.0781 37.0675 37.0580 37.0497 37.5563 37.5495 37.5403 37.5288 37.5151 37.4995 37.4822 37.4632 37.4430 37.4217 37.3996 37.3769 37.3539 37.3307 37.3077 37.2849 37.2626 37.2410 37.2201 37.2001 37.1812 37.1633 37.1465 37.1308 37.1163 37.1030 37.0908 37.0797 37.0697 37.0607 37.5260 37.5197 37.5114 37.5011 37.4890 37.4753 37.4601 37.4435 37.4257 37.4070 37.3875 37.3674 37.3470 37.3263 37.3056 37.2851 37.2648 37.2450 37.2258 37.2072 37.1894 37.1724 37.1564 37.1412 37.1271 37.1139 37.1017 37.0904 37.0801 37.0707
B=3.1e98;
R=8.313;
Ea=6.28e5 ;
Omega=integral (@(t) B* exp(-Ea./(R.* V)),0,1, 'ArrayValued',1)
Omega = 9×51
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
fprintf('Of %d elements of ''Omega'', %d elements are zero.', numel(Omega),nnz(Omega==0))
Of 459 elements of 'Omega', 459 elements are zero.
figure
surf(Omega)
.

More Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 9 Sep 2021
There are a few errs in your tiny code. Here is the corrected one:
load V.mat
B=3.1e98;
R=8.313;
Ea=6.28e5 ;
% Check your formulation in this function handle that presumably should contain variable "t"!
Fun=@(t)(B*exp(-Ea./(R.* V)));
Omega=integral(Fun,0,1, 'ArrayValued',true);

Tags

Community Treasure Hunt

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

Start Hunting!