Time for action - plotting parametric curves
1. First, we need to instantiate the variable x, for example:
octave:118> x = linspace(0, 10*pi)';
2. Then, we calculate the range of f:
octave:119> f = [cos(x), sin(x), exp(-0.5*x)];
3. Just check that we got the right size:
octave:120> size(f) ans = 100 3
4. We can now plot the curve using plot3:
octave:121> plot3(f(:,1), f(:,2), f(:,3), "linewidth", 4)
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...