Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm trying to plot replicate a graph from one of the articles and it has series of equations it has solved.

here is my code so far:

Tan [o] == 2 Cot[B]*(M^2*Sin[B]*Sin[B] - 1)/(M^2*(1.4 + Cos[2 B]) + 2); 

Pr1[o_, M_] := 1 + 2*1.4/2.4*(M^2*Sin[B]*Sin[B] - 1)
Plot[Table[Pr1[o, M], {o, {10*Pi/180}}] // Evaluate, {M, 1, 3}, AxesOrigin -> {1, 0}]

The variables o, B and M are related to the tangent expression. After that I'm trying to solve the next equation and plot that with certain value of o and as M varies from 1 to 3. For some reason, I'm not getting any error but my graph isn't showing up at all.

Also note that the tan expression produces 6 roots for given M and o, I want to only take the lowest positive value out of the 6 roots.


Edit

Here is my new code. I used the 4th root instead of 1st one. Thank to belisarius for helping out:

s = Solve[Tan[o] == 2 Cot[B]*(M^2*Sin[B]*Sin[B] - 1)/(M^2*(1.4 + Cos[2 B]) + 2), {B}];

Pr1[o_, M_] := 1 + 2*1.4/2.4*(M^2*Sin[B]*Sin[B] - 1)
Plot[Table[Evaluate[Pr1[o, M] /. s[[4]]], {o, {10*Pi/180}}], {M, 1, 3}, 
  AxesOrigin -> {1, 0}, Evaluated -> True]

enter image description here

The plot shows a step near the value of ~1.4 of M. I want to eliminate this. Any suggestions?

share|improve this question
    
You can either take the region after that point with the option PlotRange -> {{1.425, 3}, All} or exclude that region with the option RegionFunction -> Function[{x, y}, (x > 1.425)]. –  Spawn1701D Apr 12 '13 at 3:52
    
For Information: Using single capital letters for variable names is discouraged as they often conflict with built in functions, i.e. D, N. –  image_doctor Apr 12 '13 at 11:00
add comment

1 Answer

A kickstart:

s = Solve[ Tan[o] == 2 Cot[B]*(M^2*Sin[B]*Sin[B] - 1)/(M^2*(1.4 + Cos[2 B]) + 2), {B}];

Pr1[o_, M_] := 1 + 2*1.4/2.4*(M^2*Sin[B] - 1)
Plot[Table[Pr1[o, M] /. s[[1]], {o, 0, 2 Pi, Pi/4}], {M, 1, 3}, 
     AxesOrigin -> {1, 0}, Evaluated -> True]

enter image description here

You have to be careful about what solutions you use from s

share|improve this answer
    
Thank you! I just realized I made few corrections which are edited in the question now. I'm using the 4th root which is the first positive one. Also, the new graph has a sort of a step function before M = 1.4, any way for me to eliminate from the graph? –  user6850 Apr 11 '13 at 19:33
    
Why use bot Evaluate and Evaluated -> True? –  m_goldberg Apr 13 '13 at 7:29
    
@m_goldberg I was trying both and forgot to remove one of them when posting. Thanks. –  belisarius Apr 13 '13 at 11:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.