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:
Symbolic Solve

Subject: Symbolic Solve

From: jcamp@gdds.com (Jamie Camp)

Date: 7 Sep, 2001 11:02:14

Message: 1 of 4

Is there a way to solve a symbolic expression fo a given range.
This is what I get when solving sin(t) = 0.

>> syms t
>> solve(sin(t))
 
ans =
0

How would I find the zero crossing for the range 0 - 2*pi?

Subject: Symbolic Solve

From: nospam@thank.you (Denis Gilbert)

Date: 7 Sep, 2001 15:44:28

Message: 2 of 4

On 7 Sep 2001 11:02:14 -0400, jcamp@gdds.com (Jamie Camp) wrote:

>Is there a way to solve a symbolic expression fo a given range.
>This is what I get when solving sin(t) = 0.
>
>>> syms t
>>> solve(sin(t))
>
>ans =
>0
>
>How would I find the zero crossing for the range 0 - 2*pi?


Jamie, if you do not absolutely require a symbolic solution, have you
considered using FZERO ?

>> fzero(@sin,[0.001 2*pi - 0.001])

ans =

       3.1416


HTH, Denis.

Subject: Symbolic Solve

From: Nagaraj

Date: 10 Oct, 2012 17:55:08

Message: 3 of 4

@ Denis Gilbert

Can FZERO be used for symbolic functions also.If not is there anything similar to solve a symbolic function for zeros in a particular range?

Subject: Symbolic Solve

From: Christopher Creutzig

Date: 7 Nov, 2012 15:25:04

Message: 4 of 4

On 10.10.12 19:55, Nagaraj wrote:

> Can FZERO be used for symbolic functions also.If not is there anything similar to solve a symbolic function for zeros in a particular range?

You can use matlabFunction to go from a symbolic expression to a MATLAB
function to put into fsolve. Starting with R2012b, you also can use
vpasolve to find a zero in a particular range to arbitrary precision:

>> digits(250);
>> syms x
>> vpasolve(x==tan(x),x,[1 10])

ans =

4.49340945790906417530788092728032208221558387229004080289582396192695031459710409872905780945587969152176921986101428008568950973837169226786523228158753336436342557769247772183152833561261906217432432095525445842817181981287699164507943665749874656

>> tan(ans)

ans =

4.49340945790906417530788092728032208221558387229004080289582396192695031459710409872905780945587969152176921986101428008568950973837169226786523228158753336436342557769247772183152833561261906217432432095525445842817181981287699164507943665749874656


HTH,
Christopher

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