How to plot implicit function using ezplot in octave?

Viewed 44

newTheta Vector is of size 4

  -6.3702
   0.5712
   0.2067
   0.3877

It can plot:

ezplot("-6.3702 + 0.5712*x + 0.2067*y + 0.3877*x*y", [-10 10]);

see figure

But the problem occurs when I pass values of newTheta vector into the equation.
Octave can plot the following command:

ezplot(@(x,y) newTheta(1) + newTheta(2)*x + newTheta(3)*y, [-10 10]);

see figure

But does not plot this command:

ezplot(@(x,y) newTheta(1) + newTheta(2)*x + newTheta(3)*y + newTheta(4)*x *y, [-10 10])

the graph is blank

1 Answers

Consider using a dot, .*, when multiplying for vectorization because x and y are vectors. This should work:

newTheta  = [-6.3702
   0.5712
   0.2067
   0.3877];

ezplot(@(x,y) newTheta(1) + newTheta(2)*x + newTheta(3)*y + newTheta(4)*x .*y, [-10 10])

enter image description here

Related