Numerical integration in matlab2018

2 Ansichten (letzte 30 Tage)
Pavan Kumar
Pavan Kumar am 22 Apr. 2019
Kommentiert: Adam Danz am 22 Apr. 2019
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 Kommentare
Pavan Kumar
Pavan Kumar am 22 Apr. 2019
I dint get you completely...
Do i need to use a for loop for this kind of integration?
Adam Danz
Adam Danz am 22 Apr. 2019
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?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by