Link to home
Start Free TrialLog in
Avatar of Math Tec
Math TecFlag for United States of America

asked on

Integrating from high to low values

Hi,
I am trying to check integration using two different methods, first by using [function (int)] and second by using summation. I am integration from high to low values (0.1 to 0). I got same result. However, from function I got positive value (0.005) and from summation, negative value (-0.005).  I am not sure if that because I am integrating from high to low values so I need to use (dr) in negative value when finding the integration using summation.

I used below code

 
 clear all;
  clc;
  syms x y 
  y = -x; 
  z=int(y,x);
  v=[0:0.1/19:0.1];
  dr=0.1/20;
  for i=1:20
      x=v(i);  
      kk(i)=eval(y)*(dr);    
  end
  R1=sum(kk(1,:));
  x=0.1;
  z1=eval(z);
  x=0;
  z2=eval(z);
  R2=z2-z1;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of d-glitch
d-glitch
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Math Tec

ASKER

Thank you