MATLAB Script Help - Plotting 2 Functions to Find Intersection

  • Context: MATLAB 
  • Thread starter Thread starter MMCS
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 3K views
MMCS
Messages
151
Reaction score
0
Attahced is my short MATLAB script, I am basically trying to use iteration to plot 2 sets of 2 functions to see where they intersect, all other information in the script are constants. attached also is the incorrect graph that i get

flux = F

If = Ifield

Any help would be appreciated
 

Attachments

  • matlab.jpg
    matlab.jpg
    19.1 KB · Views: 549
Physics news on Phys.org
You plotted a few points instead of each function.

The way you've defined everything, there are no variables. Everything is a constant, which is why you only get points. Should you be varying w to plot each function?

Also, if you just want to know where the two functions of the form m = tanh(m) intersect, you can also plot m-tanh(m) and use fzero() to find the zero where they are equal.