fplot3
expects anonymous functions as inputs. So, you can use
fplot3(@(t) t, @(t) -4, @(t) t.^2+17)
Note the use of .^
, which is element-wise power.
The above works, but gives a warning
Warning: Function fails on array inputs. Use element-wise operators to increase speed.
The reason is that the second function outputs a scalar, instead of an array the same size as the input t
. To solve this, replace that function as follows:
fplot3(@(t) t, @(t) repmat(-4, size(t)), @(t) t.^2+17)
Also, you can specify the range of t
as a fourth input:
fplot3(@(t) t, @(t) repmat(-4, size(t)), @(t) t.^2+17, [-10 10])
