Why won't this equation plot?

1 view (last 30 days)
Peter Tran
Peter Tran on 30 Sep 2015
Commented: Star Strider on 30 Sep 2015
Hey everyone I'm trying to get this code to plot the equation 'os' but it won't output anything onto my figure. Thanks for any help or suggestions, I appreciate it!
z=0.1:.05:.9;
os = 100*exp(-pi*z/(1-z.^2).^(1/2));
plot(z,y);

Accepted Answer

Star Strider
Star Strider on 30 Sep 2015
You need to vectorise your os assignment, then you have to tell plot to plot ‘os’ rather than ‘y’:
z=0.1:.05:.9;
os = 100*exp(-pi*z./(1-z.^2).^(1/2));
plot(z,os)
  2 Comments
Peter Tran
Peter Tran on 30 Sep 2015
Wow, I forgot to vectorize before dividing. Thanks for catching that for me!

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!