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:
integrating with the symbolic toolbox

Subject: integrating with the symbolic toolbox

From: Ravi

Date: 10 Nov, 2012 14:56:17

Message: 1 of 3

Hi,
I seem to have got stuck up with an apparently simple problem with the symbolic toolbox. Would appreciate help in solving this.

%%%%%
syms x y
% I want to integrate a second derivative
int(diff(y,x,2),x,0,x)
%%%%%

I am trying to follow a derivation in a textbook. There, the answer seems to be :
1/2*(dy/dx)^2. I would have thought that it was (dy/dx). I get an answer of 0 from the above code. What is my mistake in coding? Would appreciate it if somebody could point out the error in my understanding also.
Thanks,
Ravi

Subject: integrating with the symbolic toolbox

From: Eduardo Montoya

Date: 10 Nov, 2012 18:29:15

Message: 2 of 3

"Ravi" wrote in message <k7lpuh$gbe$1@newscl01ah.mathworks.com>...
> Hi,
> I seem to have got stuck up with an apparently simple problem with the symbolic toolbox. Would appreciate help in solving this.
>
> %%%%%
> syms x y
> % I want to integrate a second derivative
> int(diff(y,x,2),x,0,x)
> %%%%%
>
> I am trying to follow a derivation in a textbook. There, the answer seems to be :
> 1/2*(dy/dx)^2. I would have thought that it was (dy/dx). I get an answer of 0 from the above code. What is my mistake in coding? Would appreciate it if somebody could point out the error in my understanding also.
> Thanks,
> Ravi

you have to tell matlab to assume that y is a function of x.

y = sym('y(x)')
syms x
int(diff(y,x,2),x)

ans =
diff(y(x), x)

Subject: integrating with the symbolic toolbox

From: Ravi

Date: 11 Nov, 2012 15:53:13

Message: 3 of 3

Hi,
Thanks a lot for your tip.
Thanks,
Ravi
> > %%%%%
> > syms x y
> > % I want to integrate a second derivative
> > int(diff(y,x,2),x,0,x)
> > %%%%%

> you have to tell matlab to assume that y is a function of x.
>
> y = sym('y(x)')
> syms x
> int(diff(y,x,2),x)
>
> ans =
> diff(y(x), x)

Tags for 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