Numerical integration in matlab2018

2 次查看(过去 30 天)
Dear Friends,
This looks simple but am not able to get it. Could you help me out.
I have the following variable in a equation that needs to be integrated
its like
L = linspace(0.3,4.5,2000);
T = 100;
fun = @(T) ((0.4175./L.^3) - (0.6643./L.^2) + (0.9036./L) + 3.5332 - 0.0744.*L).*10^-5.*(1 + 0.00276.*T);
q = integral(fun,20,T)
However, when i rum this, iam getting an error. Could you help me out on solving this.
  3 个评论
Pavan Kumar
Pavan Kumar 2019-4-22
I dint get you completely...
Do i need to use a for loop for this kind of integration?
Adam Danz
Adam Danz 2019-4-22
Check out these examples provided by matlab (link below). When you evalue the functions in those example, you'll see that they return a single value.
When I evaluate your function, a vector is returned:
>> fun(20)
ans =
Columns 1 through 6
0.00015411 0.00015159 0.00014914 0.00014676 0.00014444 0.0001422
Columns 7 through 12
0.00014002 0.0001379 0.00013584 0.00013383 0.00013189 0.00012999
Columns 13 through 18
0 ...... (2000 elements long)
Did you expect that your function returns a single value or do you expect that it returns a vector?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by