Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
matlab

Subject: matlab

From: rahul anand

Date: 7 Jul, 2011 12:21:07

Message: 1 of 4

Sir,I want to plot a definite integral,but its not happening .It gives errors such as int can't take double and all that.Plz give an example of the plot

Subject: matlab

From: Wayne King

Date: 7 Jul, 2011 12:52:11

Message: 2 of 4

"rahul anand" wrote in message <iv48bj$5lg$1@newscl01ah.mathworks.com>...
> Sir,I want to plot a definite integral,but its not happening .It gives errors such as int can't take double and all that.Plz give an example of the plot

Hi, You should include your code so people can see what you are trying to do. If you are working with a symbolic expression (which your inclusion of double in your post seems to indicate that you are not), then you can use ezsurf. If you are really using a numerical expression, then I would think you should be using quad2d to evaluate the double integral.

At any rate, including your code would clear things up.

Wayne

Subject: matlab

From: Roger Stafford

Date: 7 Jul, 2011 23:29:10

Message: 3 of 4

"rahul anand" wrote in message <iv48bj$5lg$1@newscl01ah.mathworks.com>...
> Sir,I want to plot a definite integral,but its not happening .It gives errors such as int can't take double and all that.Plz give an example of the plot
- - - - - - - - - - -
  If you are trying to plot a definite integral as a function of only a varying upper limit of integration, you might consider using a cumulative integration method such as 'cumtrapz'. If that isn't accurate enough, there are higher order integration routines on the matlab file exchange (including my own at:

 http://www.mathworks.com/matlabcentral/fileexchange/19152 )

Roger Stafford

Subject: matlab

From: Roger Stafford

Date: 8 Jul, 2011 01:25:25

Message: 4 of 4

"rahul anand" wrote in message <iv48bj$5lg$1@newscl01ah.mathworks.com>...
> Sir,I want to plot a definite integral,but its not happening .It gives errors such as int can't take double and all that.Plz give an example of the plot
- - - - - - - - - -
  Afterthought: You can generate the definite integral with varying upper limit as the solution to a differential equation using one of matlab's ode solvers. That would also give you data you could use for plotting. The form of differential equation would be:

 dI(t)/dt = f(t)

where f(t) is the integrand function you are integrating and I(t) is its definite integral with a varying upper limit. You would give I = 0 as the initial value of I when t starts at the lower limit.

  The advantage of doing that as opposed to using quad or some other quadrature routine is that it would avoid integrating repeatedly over a range that always begins at the same fixed start point and ends at a varying endpoint, an inherently inefficient procedure.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us