{"id":3662,"date":"2017-07-22T07:05:36","date_gmt":"2017-07-22T07:05:36","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=3662"},"modified":"2021-03-20T14:22:50","modified_gmt":"2021-03-20T14:22:50","slug":"3d-surface-plot-example-using-octave","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/3d-surface-plot-example-using-octave\/","title":{"rendered":"3D Surface Plot Example using Octave"},"content":{"rendered":"<h3>Introduction<\/h3>\n<p>In this tutorial, we will learn to plot a 3D Surface plot using Octave. Useful functions to plot in 3D are as follows :<\/p>\n<ul>\n<li><strong>linspace<\/strong><\/li>\n<li><strong>meshgrid<\/strong><\/li>\n<li><strong>surf<\/strong><\/li>\n<\/ul>\n<h3>Code Listing<\/h3>\n<pre>% 3D Surface Plot Example\r\n        % www.TestingDocs.com\r\n        points = linspace(-3,3,100);\r\n        [x,y] = meshgrid(points,points);\r\n        z= -3.\/(1+ x.^2 + y.^2);\r\n        surf(x,y,z);\r\n        xlabel(\"x-axis\");\r\n        ylabel(\"y-axis\");\r\n        zlabel(\"z-axis\");\r\n        title(\"Surface Plot Example - www.TestingDocs.com\");<\/pre>\n<pre><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3666\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Octave-Code.png\" alt=\"Surface Plot Octave Code\" width=\"1920\" height=\"1080\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Octave-Code.png 1920w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Octave-Code-300x169.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Octave-Code-1024x576.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Octave-Code-768x432.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Octave-Code-1536x864.png 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<h3>Screenshot<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3665\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Example.png\" alt=\"Surface Plot Example\" width=\"1920\" height=\"1080\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Example.png 1920w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Example-300x169.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Example-1024x576.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Example-768x432.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Surface-Plot-Example-1536x864.png 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<h3>Notes<\/h3>\n<p><strong>linspace (start, end, n)<\/strong><\/p>\n<p>linspace returns a row vector with n linearly spaced elements between the start and end<br \/>\nparameters.<\/p>\n<p><strong>meshgrid(x,y)<\/strong><\/p>\n<p>meshgrid returns the 2D grid matrices for the passed x and y vectors.<\/p>\n<p><strong>surf<\/strong><\/p>\n<p>surface mesh is plotted with the output of the <strong>meshgrid<\/strong> 2D matrices.<\/p>\n<p>To know more about any function use the doc command in the command window.<\/p>\n<p>&gt;&gt; doc &lt;functionName&gt;<\/p>\n<p>For example, to know more about linspace function usage, type the command :<\/p>\n<p>&gt;&gt; doc linspace<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Octave Tutorial on this website can be found at:<br \/>\n<a href=\"https:\/\/www.testingdocs.com\/octave-tutorial\/\">https:\/\/www.testingdocs.com\/octave-tutorial\/<\/a><\/p>\n<p>More information on Octave can be found on the official website:<br \/>\n<a href=\"https:\/\/www.gnu.org\/software\/octave\/index\" rel=\"noopener\">https:\/\/www.gnu.org\/software\/octave\/index<\/a><\/p>\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-3662\" data-postid=\"3662\" class=\"themify_builder_content themify_builder_content-3662 themify_builder tf_clear\">\n    <\/div>\n<!--\/themify_builder_content-->\n","protected":false},"excerpt":{"rendered":"<p>Introduction In this tutorial, we will learn to plot a 3D Surface plot using Octave. Useful functions to plot in 3D are as follows : linspace meshgrid surf Code Listing % 3D Surface Plot Example % www.TestingDocs.com points = linspace(-3,3,100); [x,y] = meshgrid(points,points); z= -3.\/(1+ x.^2 + y.^2); surf(x,y,z); xlabel(&#8220;x-axis&#8221;); ylabel(&#8220;y-axis&#8221;); zlabel(&#8220;z-axis&#8221;); title(&#8220;Surface Plot Example [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[],"class_list":["post-3662","post","type-post","status-publish","format-standard","hentry","category-octave","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/3662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=3662"}],"version-history":[{"count":10,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/3662\/revisions"}],"predecessor-version":[{"id":19593,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/3662\/revisions\/19593"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=3662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=3662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=3662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}