Help using fzero function in matlab

  • Context: MATLAB 
  • Thread starter Thread starter Pepsi24chevy
  • Start date Start date
  • Tags Tags
    Function Matlab
Click For Summary
SUMMARY

The discussion focuses on using the MATLAB fzero function to find equilibrium points for the nonlinear differential equation dy/dt = 3sin(y) + y - 2. The user successfully generated a direction field using meshgrid and quiver functions but seeks guidance on applying fzero to locate the approximate equilibria, which are known to be around 0.5 and 4. An additional participant suggests treating the right-hand side (RHS) as an algebraic equation and using MATLAB's help function for further assistance.

PREREQUISITES
  • Understanding of nonlinear differential equations
  • Familiarity with MATLAB functions such as meshgrid and quiver
  • Knowledge of the fzero function in MATLAB
  • Basic concepts of equilibrium points in differential equations
NEXT STEPS
  • Learn how to implement the fzero function in MATLAB for finding roots of equations
  • Explore the use of MATLAB's help function for function-specific guidance
  • Study the graphical interpretation of equilibrium points in direction fields
  • Investigate alternative methods for solving nonlinear equations in MATLAB
USEFUL FOR

Students, researchers, and engineers working with differential equations in MATLAB, particularly those interested in numerical methods for finding equilibria in nonlinear systems.

Pepsi24chevy
Messages
65
Reaction score
0
Hey guys i have nonlinear equation: dy/dt = 3siny + y - 2. I got the direction field with this

>> [T,Y] = meshgrid(-5:00.2:5, -5:0.2:5);
>> S = (3*sin(Y))+Y-2;
>> L = sqrt(1 + S.^2);
>> quiver(T, Y, 1./L, S./L, 0.5), axis tight
>> xlabel 't', ylabel 'y'
>> title 'Direction Field for dy/dt = (3*sin(Y))+Y-2'

NOw i need to use fzero function to find approximate values for all the equilibria of the system. I just dont' know how to use fzero with a dif equation like this. ANy help is appreciated. thanks Also, i know the values are around 0.5 and 4.
 
Physics news on Phys.org
Pepsi24chevy said:
Hey guys i have nonlinear equation: dy/dt = 3siny + y - 2. I got the direction field with this

>> [T,Y] = meshgrid(-5:00.2:5, -5:0.2:5);
>> S = (3*sin(Y))+Y-2;
>> L = sqrt(1 + S.^2);
>> quiver(T, Y, 1./L, S./L, 0.5), axis tight
>> xlabel 't', ylabel 'y'
>> title 'Direction Field for dy/dt = (3*sin(Y))+Y-2'

NOw i need to use fzero function to find approximate values for all the equilibria of the system. I just dont' know how to use fzero with a dif equation like this. ANy help is appreciated. thanks Also, i know the values are around 0.5 and 4.

The equilibrium points for an autonomous DE are the values of y such that the RHS=0. If I plot the RHS as a function of y, I get 3 zeros. I use Mathematica so can't help with matlab. Doesn't it have a help function? You know, place the cursor on the function then press the F1 key. Surely you can just treat it (RHS) as an algebraic equation in y and solve for the roots right?
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K