{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%plot --format svg"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"clear all\n",
"x = linspace(-4*pi, 4*pi, 100);\n",
"plot (x, sin (x));\n",
"xlabel('x-axis')\n",
"ylabel('y-axis')\n",
"title('Sine function')\n",
"axis([-12, 12, -1.5, 1.5])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"clear all\n",
"figure(2)\n",
"x = linspace(-3, 3, 100);\n",
"y1 = x;\n",
"y2 = x.^3;\n",
"y3 = x.^5;\n",
"plot(x, y1, 'r')\n",
"hold on\n",
"plot(x, y2, 'g')\n",
"hold on\n",
"plot(x, y3, 'b')\n",
"axis('equal')\n",
"xlabel('x-axis')\n",
"ylabel('y-axis')\n",
"title('Power Functions Plots')\n",
"axis([-3, 3, -3, 3])\n",
"legend('y = x','y = x^2','y = x^3')\n",
"hold off"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"clear all\n",
"x = linspace(-4*pi, 4*pi, 100);\n",
"y1 = sin(x);\n",
"y2 = cos(x);\n",
"y3 = exp(x);\n",
"y4 = cosh(x);\n",
"subplot(2,2,1)\n",
"plot(x, y1, 'r')\n",
"subplot(2,2,2)\n",
"plot(x, y2, 'g')\n",
"subplot(2,2,3)\n",
"plot(x, y3, 'b')\n",
"axis([-3, 3, -1, 20])\n",
"subplot(2,2,4)\n",
"plot(x, y4, 'k')\n",
"axis('equal')\n",
"axis([-3, 3, 0, 6])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"tx = ty = linspace (-8, 8, 41);\n",
"[xx, yy] = meshgrid (tx, ty);\n",
"r = sqrt (xx .^ 2 + yy .^ 2) + eps;\n",
"tz = sin (r) ./ r;"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"subplot(2,2,1)\n",
"mesh (tx, ty, tz);\n",
"subplot(2,2,2)\n",
"surf(r)\n",
"subplot(2,2,3)\n",
"contourf(xx,yy,r,5)\n",
"subplot(2,2,4)\n",
"contour(xx,yy,r,5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Octave",
"language": "octave",
"name": "octave"
},
"language_info": {
"file_extension": ".m",
"help_links": [
{
"text": "GNU Octave",
"url": "https://www.gnu.org/software/octave/support.html"
},
{
"text": "Octave Kernel",
"url": "https://github.com/Calysto/octave_kernel"
},
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-octave",
"name": "octave",
"version": "3.8.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}