Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
GNU Octave Beginner's Guide

You're reading from   GNU Octave Beginner's Guide Become a proficient Octave user by learning this high-level scientific numerical tool from the ground up

Arrow left icon
Product type Paperback
Published in Jun 2011
Publisher Packt
ISBN-13 9781849513326
Length 280 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Jesper Schmidt Hansen Jesper Schmidt Hansen
Author Profile Icon Jesper Schmidt Hansen
Jesper Schmidt Hansen
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

GNU Octave
Credits
About the Author
About the Reviewers
1. www.PacktPub.com
2. Preface
1. Introducing GNU Octave FREE CHAPTER 2. Interacting with Octave: Variables and Operators 3. Working with Octave: Functions and Plotting 4. Rationalizing: Octave Scripts 5. Extensions: Write Your Own Octave Functions 6. Making Your Own Package: A Poisson Equation Solver 7. More Examples: Data Analysis 8. Need for Speed: Optimization and Dynamically Linked Functions Pop quiz - Answers

Time for action - plotting parametric curves


  1. 1. First, we need to instantiate the variable x, for example:

octave:118> x = linspace(0, 10*pi)';
  1. 2. Then, we calculate the range of f:

octave:119> f = [cos(x), sin(x), exp(-0.5*x)];
  1. 3. Just check that we got the right size:

octave:120> size(f)
ans =
100 3
  1. 4. We can now plot the curve using plot3:

octave:121> plot3(f(:,1), f(:,2), f(:,3), "linewidth", 4)
  1. 5. To set the right properties, we can use:

octave:122> set(gca, "linewidth", 2, "fontsize", 20);
octave:123> set(gca, "xlabel", text("string", "x","fontsize", 30);
octave:124> set(gca, "ylabel", text("string", "y","fontsize", 30);
octave:125> set(gca, "zlabel", text("string", "z","fontsize", 30);
octave:126> set(gca, "zlim", [0 1.2])
octave:127> text(0.9, -0.25, 0.9, "t=0", "fontsize", 30)
octave:128> view(20,30)
  • Phew! The final figure is shown below:

What just happened?

In Command 119, we calculated the range of the interval—notice the transpose operator in Command...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime