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:
How can we plot integral graph?

Subject: How can we plot integral graph?

From: Noelle

Date: 15 May, 2011 18:28:05

Message: 1 of 5

I have this equation to get the integral.

dx/dt = - (exp(-t/5)*x^(-3), x(0) = 10,


and I'd like to get a MATLAB model to numerically integrate the differential equation.
For this, I made a code like this
>> syms x t;
>> int(- (exp(-t/5))*x^(-3),t)
 
ans =
 
5/(x^3*exp(t/5))


does this look nice?
Also, I'd like to plot the response x(t). How can I do this?

Subject: How can we plot integral graph?

From: Roger Stafford

Date: 15 May, 2011 22:13:02

Message: 2 of 5

"Noelle" wrote in message <iqp5vl$mqg$1@newscl01ah.mathworks.com>...
> I have this equation to get the integral.
>
> dx/dt = - (exp(-t/5)*x^(-3), x(0) = 10,
>
>
> and I'd like to get a MATLAB model to numerically integrate the differential equation.
> For this, I made a code like this
> >> syms x t;
> >> int(- (exp(-t/5))*x^(-3),t)
>
> ans =
>
> 5/(x^3*exp(t/5))
>
>
> does this look nice?
> Also, I'd like to plot the response x(t). How can I do this?
- - - - - - - - - - -
  The solution should be

 x(t) = (20*exp(-t/5)+9980)^(1/4)

  You should be using 'dsolve', not 'int'. I believe this differential equation is beyond the capabilities of 'int'.

  Another way is to do this by ordinary calculus.

 x^3*dx = -exp(-t/5)*dt

and integrate both sides getting

 x4/4 = 5*exp(-t/5) + C

where you use the condition x(0) = 0 to find C.

Roger Stafford

Subject: How can we plot integral graph?

From: Noelle

Date: 16 May, 2011 13:20:09

Message: 3 of 5

Hmm.. I used

S = dsolve(- (exp(-t/5))*x^(-3)','x(0)=10','t');
but it constantly gives me an error

??? Error using ==> maplemex
Error, (in dsolve) found the following equations not depending on the unknowns of the
input system: {20 = 10}

Error in ==> dsolve at 104
    r = sym(maplemex(0,'MTM:-dsolve',varargin{:},'returnlist=true'));
 

I googled this error for about an hour and tried to figure out but still have no idea. If I change the x to y, it gives a numerical answer.

Does anybody know what is wrong?

Subject: How can we plot integral graph?

From: Steven_Lord

Date: 16 May, 2011 13:36:59

Message: 4 of 5



"Noelle " <ychang912@yahoo.com> wrote in message
news:iqr8a9$3vi$1@newscl01ah.mathworks.com...
> Hmm.. I used
>
> S = dsolve(- (exp(-t/5))*x^(-3)','x(0)=10','t');
> but it constantly gives me an error
>
> ??? Error using ==> maplemex
> Error, (in dsolve) found the following equations not depending on the
> unknowns of the
> input system: {20 = 10}
>
> Error in ==> dsolve at 104
> r = sym(maplemex(0,'MTM:-dsolve',varargin{:},'returnlist=true'));
>
>
> I googled this error for about an hour and tried to figure out but still
> have no idea. If I change the x to y, it gives a numerical answer.
>
> Does anybody know what is wrong?

Your call to DSOLVE doesn't include a derivative term.

S = dsolve('Dx = -exp(-t/5)*x^(-3)', 'x(0) = 10', 't')

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: How can we plot integral graph?

From: Torsten

Date: 16 May, 2011 13:38:41

Message: 5 of 5

On 16 Mai, 15:20, "Noelle " <ychang...@yahoo.com> wrote:
> Hmm.. I used
>
> S = dsolve(- (exp(-t/5))*x^(-3)','x(0)=10','t');
> but it constantly gives me an error
>
> ??? Error using ==> maplemex
> Error, (in dsolve) found the following equations not depending on the unknowns of the
> input system: {20 = 10}
>
> Error in ==> dsolve at 104
>     r = sym(maplemex(0,'MTM:-dsolve',varargin{:},'returnlist=true'));
>
> I googled this error for about an hour and tried to figure out but still have no idea. If I change the x to y, it gives a numerical answer.
>
> Does anybody know what is wrong?


S = dsolve('Dx+(exp(-t/5))*x^(-3)=0','x(0)=10','t');

Best wishes
Torsten.

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