How to solve an equation in a certan interval.

4 ビュー (過去 30 日間)
Nuno
Nuno 2012 年 12 月 2 日
Problem:
syms w; % variable, that define the y axis
lam = 4*pi()^2 % constant, that define the x axis
tan(w/2) == w/2 - (4/(lam))*(w/2)^3 % equation
That equation with that constant has many solutions. What I pretend is to resolve the equation (maybe with solve) for lam = 4*pi()^2, in a certain interval of y, in order to catch a specific solution. For example, I know that for that constant there is a solution of w/pi() = 2 in the interval w/pi()=[1.5 2.5], (y axis).
I was trying with this:
syms w;
lam=4.*pi().^2;
x = fsolve(@(w) tan(w/2) == w/2 - (4./(lam)).*(w/2).^3, [1.5*pi() 2.5*pi()]);
X=x/pi()
But is giving me some problems that I can´t resolve.
On Maple software the structure of the program is more or less the same, but it gives me the solutions that I want in specific intervals of y axis.
Matlab has to do it too or it doesn't?
Thanks to all.

採用された回答

Walter Roberson
Walter Roberson 2012 年 12 月 2 日
The function you provide to fsolve() needs to have a numeric result rather than a logical result. Convert your form A==B to (A)-(B) or (B)-(A)
  4 件のコメント
Nuno
Nuno 2012 年 12 月 8 日
In "fsolve" can you use an interval? because if you put a number in the place of the interval, the fsolve gives you one number, but if you put [number1 number2], it gives you two numbers. It is ridiculuos when you should get just one, the solution.
Walter Roberson
Walter Roberson 2012 年 12 月 8 日
No, fsolve() does not take an interval. When you provide multiple values for x0 it becomes an equation with multiple variables. fzero() is the one that takes an interval.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by